-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathchromium-111.0.5563.111.patch
22091 lines (20471 loc) · 918 KB
/
chromium-111.0.5563.111.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
From b0b664bf60f914744a7127d483c8d744d1d38e9d Mon Sep 17 00:00:00 2001
From: Virtual-Browser <virtual.browser.2020@gmail.com>
Date: Tue, 13 Jun 2023 21:43:04 +0800
Subject: [PATCH] support for win7
---
.../address_space_randomization.cc | 24 +-
.../address_space_randomization.h | 8 +-
.../address_space_randomization_unittest.cc | 8 +
.../page_allocator_internals_win.h | 32 +-
base/base_paths_win.cc | 3 +
base/debug/invalid_access_win.cc | 12 +
base/files/file_util_win.cc | 36 +-
base/memory/discardable_shared_memory.cc | 14 +-
.../platform_shared_memory_region_win.cc | 22 +-
base/path_service_unittest.cc | 9 +-
base/process/launch_win.cc | 9 +
base/process/process_unittest.cc | 8 +-
base/process/process_win.cc | 16 +-
base/task/thread_pool/thread_group.cc | 16 +-
base/test/launcher/test_launcher.cc | 11 +-
base/test/launcher/test_launcher_unittest.cc | 18 +
base/test/launcher/unit_test_launcher.cc | 10 +
base/test/launcher/unit_test_launcher.h | 2 +
base/threading/platform_thread_win.cc | 21 +-
.../threading/platform_thread_win_unittest.cc | 22 +-
base/win/core_winrt_util_unittest.cc | 12 +-
base/win/default_apps_util.cc | 7 +
base/win/default_apps_util.h | 4 +
base/win/event_trace_controller_unittest.cc | 19 +-
base/win/hstring_compare.cc | 10 +-
base/win/hstring_compare_unittest.cc | 28 +-
base/win/hstring_reference_unittest.cc | 14 +-
base/win/map_unittest.cc | 20 +-
base/win/registry.cc | 13 +-
base/win/registry_unittest.cc | 49 +-
base/win/scoped_handle_unittest.cc | 29 +
base/win/scoped_hstring_unittest.cc | 14 +-
.../scoped_process_information_unittest.cc | 5 +
base/win/scoped_winrt_initializer.cc | 8 +-
base/win/scoped_winrt_initializer_unittest.cc | 21 +-
base/win/shortcut_unittest.cc | 59 ++
base/win/win_util.cc | 48 +-
chrome/browser/about_flags.cc | 9 +
.../caption_settings_dialog_win.cc | 7 +-
.../browser/chrome_content_browser_client.cc | 7 +
.../browser/chrome_content_browser_client.h | 1 +
.../device_reauth/win/authenticator_win.cc | 6 +
.../language_settings_private_api_unittest.cc | 9 +-
.../external_protocol_handler_browsertest.cc | 20 +
chrome/browser/icon_loader_browsertest.cc | 6 +
.../importer/edge_importer_browsertest_win.cc | 8 +
.../media/webrtc/webrtc_browsertest_base.cc | 13 +
.../media/webrtc/webrtc_browsertest_base.h | 3 +
...antivirus_metrics_provider_win_unittest.cc | 51 +-
...chrome_browser_main_extra_parts_metrics.cc | 3 +
.../net/stub_resolver_config_reader.cc | 16 +-
..._platform_bridge_win_interactive_uitest.cc | 48 +-
...tification_platform_bridge_win_unittest.cc | 24 +-
...ication_helper_launches_chrome_unittest.cc | 6 +
.../spelling_menu_observer_browsertest.cc | 28 +-
.../chrome_cleaner/reporter_runner_win.cc | 22 +-
.../chrome_cleaner/reporter_runner_win.h | 4 +
.../reporter_runner_win_unittest.cc | 12 +
chrome/browser/shell_integration.cc | 38 +-
chrome/browser/shell_integration.h | 4 +
chrome/browser/shell_integration_win.cc | 69 +-
chrome/browser/shell_integration_win.h | 16 +
..._check_host_chrome_impl_win_browsertest.cc | 4 +
...check_language_policy_handlers_unittest.cc | 3 +
.../spellchecker/spellcheck_service.cc | 13 +-
.../browser/spellchecker/spellcheck_service.h | 2 +-
.../spellcheck_service_browsertest.cc | 6 +
.../spellcheck_service_unittest.cc | 6 +
chrome/browser/themes/theme_helper_win.cc | 8 +-
chrome/browser/ui/browser_ui_prefs.cc | 7 +-
.../win/native_chrome_color_mixer_win.cc | 26 +-
chrome/browser/ui/frame/window_frame_util.cc | 2 +
.../default_browser_infobar_delegate.cc | 7 +
.../default_browser_infobar_delegate.h | 1 +
.../startup_browser_creator_browsertest.cc | 70 +-
.../chrome_native_app_window_views_win.cc | 18 +-
.../apps/chrome_native_app_window_views_win.h | 11 +-
.../apps/glass_app_window_frame_view_win.cc | 30 +-
.../views/bookmarks/bookmark_bar_view_test.cc | 13 +-
.../ui/views/chrome_views_delegate_win.cc | 17 +-
.../views/create_application_shortcut_view.cc | 12 +-
.../browser_desktop_window_tree_host_win.cc | 32 +-
.../browser_desktop_window_tree_host_win.h | 2 +
.../browser_non_client_frame_view_unittest.cc | 10 +-
chrome/browser/ui/views/frame/browser_view.cc | 3 +
.../views/frame/glass_browser_frame_view.cc | 76 +-
.../ui/views/frame/glass_browser_frame_view.h | 1 +
.../frame/minimize_button_metrics_win.cc | 47 +-
.../views/frame/minimize_button_metrics_win.h | 9 +-
.../ui/views/infobars/confirm_infobar.cc | 11 +-
.../ui/views/infobars/confirm_infobar.h | 3 +
.../views/tabs/tab_hover_card_bubble_view.cc | 40 +-
.../views/tabs/tab_hover_card_bubble_view.h | 7 +-
.../tab_hover_card_bubble_view_unittest.cc | 26 +-
chrome/browser/ui/views/tabs/tab_strip.cc | 10 +-
.../toolbar_action_hover_card_bubble_view.cc | 20 +-
.../ui/views/tooltip/tooltip_browsertest.cc | 43 +
.../touch_events_interactive_uitest_win.cc | 15 +
.../web_app_navigation_button_container.cc | 38 +-
.../app_management_page_handler.cc | 5 +-
.../webui/conflicts/conflicts_data_fetcher.cc | 15 +-
.../settings_localized_strings_provider.cc | 4 +-
.../ui/webui/settings/settings_utils_win.cc | 15 +-
chrome/browser/ui/webui/welcome/welcome_ui.cc | 7 +-
.../vr/test/gl_test_environment_unittest.cc | 9 +
.../os_integration/os_integration_manager.cc | 34 +
.../os_integration_manager_unittest.cc | 10 +
.../protocol_handling_sub_manager.cc | 16 +-
..._file_handler_registration_win_unittest.cc | 7 +-
.../web_app_handler_registration_utils_win.cc | 28 +-
...handler_registration_utils_win_unittest.cc | 50 +-
...tocol_handler_registration_win_unittest.cc | 20 +
.../web_app_shortcut_win_unittest.cc | 3 +
.../webshare/share_service_browsertest.cc | 8 +
.../webshare/share_service_unittest.cc | 3 +
.../win/fake_data_transfer_manager.cc | 5 +
.../webshare/win/fake_data_transfer_manager.h | 2 +
.../win/fake_data_transfer_manager_interop.cc | 5 +
.../win/fake_data_transfer_manager_interop.h | 2 +
..._data_transfer_manager_interop_unittest.cc | 2 +
.../fake_data_transfer_manager_unittest.cc | 3 +
...oped_fake_data_transfer_manager_interop.cc | 6 +
...coped_fake_data_transfer_manager_interop.h | 2 +
.../scoped_share_operation_fake_components.cc | 6 +
.../scoped_share_operation_fake_components.h | 2 +
.../webshare/win/share_operation_unittest.cc | 28 +
.../win/show_share_ui_for_window_operation.cc | 13 +-
..._share_ui_for_window_operation_unittest.cc | 2 +
.../incompatible_applications_browsertest.cc | 4 +
.../incompatible_applications_updater.cc | 6 +-
...ompatible_applications_updater_unittest.cc | 40 +
.../module_blocklist_cache_updater.cc | 4 +-
.../third_party_blocking_browsertest.cc | 4 +
.../third_party_conflicts_manager_unittest.cc | 9 +-
chrome/browser/win/parental_controls.cc | 4 +-
chrome/browser/win/titlebar_config.cc | 4 +-
.../system_restore_point_component.cc | 24 +-
chrome/chrome_cleaner/ipc/sandbox.cc | 4 +-
.../os/task_scheduler_unittest.cc | 11 +
chrome/chrome_cleaner/test/cleaner_test.cc | 6 +
chrome/chrome_cleaner/test/test_util.cc | 7 +-
chrome/chrome_elf/chrome_elf_security.cc | 23 +-
chrome/chrome_elf/hook_util/hook_util.cc | 38 +
chrome/chrome_elf/hook_util/hook_util.h | 12 +
chrome/chrome_elf/nt_registry/nt_registry.cc | 95 +++
chrome/chrome_elf/nt_registry/nt_registry.h | 27 +-
.../nt_registry/nt_registry_functions.h | 42 +
.../nt_registry/nt_registry_unittest.cc | 84 ++
chrome/chrome_elf/third_party_dlls/hook.cc | 24 +-
.../gaiacp/scoped_user_profile.cc | 39 +-
.../test/gcp_gls_output_unittest.cc | 48 +-
chrome/installer/setup/install.cc | 2 +
chrome/installer/setup/setup_main.cc | 4 +-
chrome/installer/setup/user_experiment.cc | 5 +
chrome/installer/util/install_util.cc | 4 +-
chrome/installer/util/shell_util.cc | 279 ++++++-
chrome/installer/util/shell_util.h | 13 +
.../util/shell_util_interactive_uitest.cc | 5 +
chrome/installer/util/shell_util_unittest.cc | 50 +-
chrome/installer/util/taskbar_util.cc | 6 +-
.../chrome_content_renderer_client.cc | 7 +
chrome/test/delayload/delayloads_unittest.cc | 10 +-
chrome/updater/run_all_unittests.cc | 8 +
chrome/updater/util/unittest_util.cc | 12 +-
chrome/updater/win/installer/installer.cc | 2 +-
.../embedder_support/user_agent_utils.cc | 77 +-
.../user_agent_utils_unittest.cc | 43 +-
.../infobars/core/confirm_infobar_delegate.cc | 4 +
.../infobars/core/confirm_infobar_delegate.h | 4 +
.../system_memory_pressure_evaluator.cc | 7 +-
.../services/quarantine/quarantine_win.cc | 21 +-
.../services/quarantine/test_support_win.cc | 7 +-
.../browser/spellcheck_platform_win.cc | 9 +-
.../browser/windows_spell_checker.cc | 3 +-
.../browser/windows_spell_checker_unittest.cc | 27 +-
.../spellcheck/common/spellcheck_features.cc | 11 +-
.../spellcheck/common/spellcheck_features.h | 2 +
.../renderer/spellcheck_provider_unittest.cc | 8 +
content/app/initialize_mojo_core.cc | 13 +-
content/browser/BUILD.gn | 2 +
..._node_textrangeprovider_win_browsertest.cc | 6 +
content/browser/browser_main_loop.cc | 11 +
.../font_unique_name_browsertest.cc | 1 +
content/browser/form_controls_browsertest.cc | 17 +
content/browser/gpu/gpu_internals_ui.cc | 5 +-
...gin_sandboxed_process_launcher_delegate.cc | 11 +-
.../direct_manipulation_helper_win.cc | 9 +
.../direct_manipulation_win_browsertest.cc | 13 +
.../direct_manipulation_win_unittest.cc | 7 +
.../dwrite_font_lookup_table_builder_win.cc | 773 ++++++++++++++++++
.../dwrite_font_lookup_table_builder_win.h | 255 ++++++
..._font_lookup_table_builder_win_unittest.cc | 241 ++++++
.../dwrite_font_proxy_impl_win.cc | 45 +-
.../dwrite_font_proxy_impl_win.h | 10 +
.../dwrite_font_proxy_impl_win_unittest.cc | 171 ++++
.../renderer_host/render_process_host_impl.cc | 1 +
...er_widget_host_view_aura_vk_browsertest.cc | 31 +
content/child/font_warmup_win.cc | 8 +-
content/child/font_warmup_win_unittest.cc | 25 +
content/child/runtime_features.cc | 9 +-
...webthemeengine_impl_default_browsertest.cc | 48 +-
.../public/browser/content_browser_client.cc | 4 +
.../public/browser/content_browser_client.h | 5 +
content/public/common/content_features.cc | 11 +-
content/public/common/content_switches.cc | 4 +
content/public/common/content_switches.h | 1 +
.../content_renderer_pepper_host_factory.cc | 8 +-
.../renderer/pepper/resource_creation_impl.cc | 10 +-
content/renderer/render_view_browsertest.cc | 10 +
.../renderer/renderer_blink_platform_impl.cc | 20 +
.../renderer/renderer_blink_platform_impl.h | 2 +
.../browser/shell_content_browser_client.cc | 5 +
.../browser/shell_content_browser_client.h | 1 +
content/test/BUILD.gn | 1 +
.../aom/aom-live-region-expected-uia-win7.txt | 5 +
.../aom-modal-dialog-expected-uia-win7.txt | 7 +
.../aria-contentinfo-expected-uia-win7.txt | 3 +
.../aria-describedby-expected-uia-win7.txt | 5 +
.../aria-description-expected-uia-win7.txt | 5 +
...ria-details-multiple-expected-uia-win7.txt | 11 +
...a-tree-discontinuous-expected-uia-win7.txt | 7 +
.../aria/aria-treegrid-expected-uia-win7.txt | 79 ++
.../add-alert-content-expected-uia-win7.txt | 5 +
...-dialog-described-by-expected-uia-win7.txt | 6 +
.../event/add-dialog-expected-uia-win7.txt | 6 +
.../add-dialog-no-info-expected-uia-win7.txt | 6 +
...a-combo-box-collapse-expected-uia-win7.txt | 5 +
.../event/aria-flow-to-expected-uia-win7.txt | 11 +
.../aria-level-changed-expected-uia-win7.txt | 3 +
.../aria-live-changed-expected-uia-win7.txt | 4 +
...ria-posinset-changed-expected-uia-win7.txt | 2 +
...aria-setsize-changed-expected-uia-win7.txt | 3 +
.../description-change-expected-uia-win7.txt | 0
...tion-change-indirect-expected-uia-win7.txt | 4 +
.../live-region-add-expected-uia-win7.txt | 4 +
...n-add-live-attribute-expected-uia-win7.txt | 2 +
.../live-region-change-expected-uia-win7.txt | 2 +
...ubar-show-hide-menus-expected-uia-win7.txt | 32 +
.../menulist-collapse-expected-uia-win7.txt | 8 +
...nulist-collapse-next-expected-uia-win7.txt | 11 +
...ility-hidden-changed-expected-uia-win7.txt | 3 +
.../html/a-name-calc-expected-uia-win7.txt | 15 +
.../button-name-calc-expected-uia-win7.txt | 20 +
.../html/footer-expected-uia-win7.txt | 3 +
...date-with-popup-open-expected-uia-win7.txt | 134 +++
...aria-setsize-unknown-expected-uia-win7.txt | 15 +
...ze-unknown-flattened-expected-uia-win7.txt | 32 +
.../html/output-expected-uia-win7.txt | 7 +
content/test/dwrite_font_fake_sender_win.cc | 9 +
content/test/dwrite_font_fake_sender_win.h | 6 +
device/bluetooth/bluetooth_adapter_factory.cc | 15 +-
device/bluetooth/bluetooth_adapter_win.cc | 11 +-
device/bluetooth/bluetooth_adapter_win.h | 8 +-
device/bluetooth/bluetooth_low_energy_win.cc | 39 +-
device/bluetooth/bluetooth_low_energy_win.h | 9 +-
.../bluetooth_low_energy_win_fake.cc | 33 +-
.../bluetooth/bluetooth_low_energy_win_fake.h | 1 +
.../bluetooth/bluetooth_task_manager_win.cc | 8 +
device/bluetooth/test/bluetooth_test_win.cc | 73 +-
device/bluetooth/test/bluetooth_test_win.h | 1 +
.../gamepad/gamepad_platform_data_fetcher.h | 4 +-
.../gamepad/wgi_data_fetcher_win_unittest.cc | 8 +
device/gamepad/xinput_data_fetcher_win.cc | 19 +-
.../api/app_window/app_window_apitest.cc | 10 +
.../dxgi_shared_handle_manager_unittest.cc | 6 +-
.../dxgi_swap_chain_image_backing.cc | 5 +-
gpu/config/gpu_info_collector_win.cc | 57 +-
gpu/ipc/service/gpu_watchdog_thread.cc | 19 +-
.../service/gpu_watchdog_thread_unittest.cc | 16 +-
media/audio/audio_encoders_unittest.cc | 6 +
.../audio/win/audio_low_latency_input_win.cc | 4 +
media/audio/win/core_audio_util_win.cc | 16 +-
media/audio/win/core_audio_util_win.h | 4 +
.../audio/win/core_audio_util_win_unittest.cc | 9 +-
media/base/win/dxgi_device_manager.cc | 13 +-
.../win/dxgi_device_scope_handle_unittest.cc | 20 +-
.../video/video_capture_device_unittest.cc | 13 +-
.../win/gpu_memory_buffer_tracker_unittest.cc | 27 +-
.../win/video_capture_device_factory_win.cc | 10 +-
...deo_capture_device_factory_win_unittest.cc | 25 +-
.../video_capture_device_mf_win_unittest.cc | 17 +-
.../win/video_capture_device_utils_win.cc | 27 +-
.../windows/d3d11_texture_wrapper_unittest.cc | 16 +
.../windows/d3d11_video_decoder_unittest.cc | 17 +-
.../dxva_video_decode_accelerator_win.cc | 31 +-
...foundation_video_encode_accelerator_win.cc | 71 +-
..._foundation_video_encode_accelerator_win.h | 2 +
media/gpu/windows/mf_audio_encoder.cc | 19 +-
.../gpu/windows/supported_profile_helpers.cc | 3 +
.../supported_profile_helpers_unittest.cc | 27 +-
media/midi/midi_manager_win.cc | 4 +-
.../services/gpu_mojo_media_client_win.cc | 15 +-
.../win/media_foundation_renderer.cc | 9 +-
.../renderers/win/media_foundation_renderer.h | 4 +-
...ia_foundation_renderer_integration_test.cc | 12 +-
.../win/media_foundation_renderer_unittest.cc | 29 +-
mojo/core/embedder/embedder.cc | 27 +-
mojo/core/embedder/embedder.h | 15 +-
net/base/network_change_notifier_win.cc | 11 +
.../network_change_notifier_win_unittest.cc | 5 +
net/cert/cert_verify_proc.cc | 17 +-
net/cert/cert_verify_proc_unittest.cc | 38 +-
net/cert/cert_verify_proc_win.cc | 72 +-
remoting/base/url_request_context_getter.cc | 18 +
remoting/host/desktop_session_win.cc | 52 +-
remoting/host/host_attributes.cc | 17 +-
remoting/host/input_injector_win.cc | 3 +-
.../remote_open_url/remote_open_url_util.cc | 7 +
remoting/host/win/evaluate_3d_display_mode.cc | 6 +
sandbox/features.cc | 4 -
sandbox/features.h | 4 +
sandbox/policy/switches.cc | 1 +
.../policy/win/sandbox_policy_feature_test.cc | 4 +-
.../policy/win/sandbox_policy_feature_test.h | 3 +
sandbox/policy/win/sandbox_win.cc | 89 +-
sandbox/win/src/address_sanitizer_test.cc | 1 +
sandbox/win/src/app_container_base.cc | 65 +-
sandbox/win/src/app_container_base.h | 3 +-
sandbox/win/src/app_container_test.cc | 30 +-
sandbox/win/src/app_container_unittest.cc | 1 +
sandbox/win/src/broker_services.cc | 29 +-
sandbox/win/src/broker_services.h | 2 +
sandbox/win/src/file_policy_test.cc | 6 +
sandbox/win/src/filesystem_policy.cc | 1 +
sandbox/win/src/handle_closer.cc | 1 +
sandbox/win/src/handle_closer_agent.cc | 6 +
sandbox/win/src/handle_inheritance_test.cc | 1 +
sandbox/win/src/heap_helper.cc | 5 +
sandbox/win/src/integrity_level_test.cc | 1 +
sandbox/win/src/interception.cc | 23 +-
sandbox/win/src/job.cc | 46 +-
sandbox/win/src/job.h | 22 +-
sandbox/win/src/job_unittest.cc | 105 ++-
sandbox/win/src/lpc_policy_test.cc | 57 +-
sandbox/win/src/named_pipe_policy_test.cc | 1 +
sandbox/win/src/nt_internals.h | 6 +
sandbox/win/src/policy_broker.cc | 1 +
sandbox/win/src/policy_target_test.cc | 26 +-
sandbox/win/src/process_mitigations.cc | 210 +++--
.../win/src/process_mitigations_deathtest.cc | 16 +
.../process_mitigations_dyncode_unittest.cc | 9 +
...ss_mitigations_extensionpoints_unittest.cc | 22 +
.../win/src/process_mitigations_unittest.cc | 275 +++++--
.../process_mitigations_win32k_dispatcher.cc | 1 +
.../process_mitigations_win32k_unittest.cc | 7 +
sandbox/win/src/process_policy_test.cc | 1 +
.../win/src/process_thread_interception.cc | 1 +
sandbox/win/src/restricted_token_unittest.cc | 3 +
sandbox/win/src/restricted_token_utils.cc | 128 ++-
sandbox/win/src/restricted_token_utils.h | 4 +-
sandbox/win/src/sandbox.h | 12 +-
sandbox/win/src/sandbox_policy_base.cc | 42 +-
sandbox/win/src/sandbox_policy_base.h | 10 +-
sandbox/win/src/service_resolver.h | 94 ++-
sandbox/win/src/service_resolver_32.cc | 334 +++++---
sandbox/win/src/service_resolver_64.cc | 5 +-
sandbox/win/src/service_resolver_unittest.cc | 166 ++--
sandbox/win/src/startup_information_helper.cc | 2 +
sandbox/win/src/startup_information_helper.h | 4 +-
sandbox/win/src/target_process.cc | 47 +-
sandbox/win/src/target_process.h | 13 +
sandbox/win/src/target_services.cc | 1 +
sandbox/win/src/win_utils.cc | 30 +
sandbox/win/src/win_utils.h | 5 +
sandbox/win/src/win_utils_unittest.cc | 9 +-
sandbox/win/src/window.cc | 54 ++
sandbox/win/tests/common/controller.cc | 6 +-
.../tests/integration_tests/cfi_unittest.cc | 7 +
.../win/location_provider_winrt_unittest.cc | 9 +-
.../power_save_blocker_win.cc | 13 +
.../face_detection_impl_win_unittest.cc | 5 +
.../face_detection_provider_win.cc | 6 +
.../text_detection_impl_win.cc | 10 +
.../text_detection_impl_win_unittest.cc | 5 +
third_party/blink/common/BUILD.gn | 1 +
.../dwrite_rasterizer_support.cc | 30 +
third_party/blink/public/common/BUILD.gn | 4 +
.../dwrite_rasterizer_support.h | 19 +
.../dwrite_font_proxy/dwrite_font_proxy.mojom | 46 +-
third_party/blink/public/platform/platform.h | 5 +
.../modules/font_access/font_metadata.cc | 7 +-
.../fonts/web_font_typeface_factory.cc | 10 +-
.../fonts/win/font_unique_name_lookup_win.cc | 133 ++-
.../fonts/win/font_unique_name_lookup_win.h | 24 +-
.../rtc_video_decoder_adapter.cc | 3 +
.../rtc_video_decoder_stream_adapter.cc | 3 +
third_party/centipede/src | 1 +
third_party/cros-components/src | 1 +
third_party/crossbench | 1 +
.../histograms/metadata/others/histograms.xml | 33 +
.../platform/ax_platform_node_win.cc | 58 +-
.../inspect/ax_inspect_test_helper.cc | 15 +-
...ative_window_occlusion_tracker_unittest.cc | 7 +-
.../native_window_occlusion_tracker_win.cc | 7 +-
..._occlusion_tracker_win_interactive_test.cc | 8 +
ui/base/ime/init/input_method_factory.cc | 4 +-
ui/base/ime/win/input_method_win_base.cc | 6 +-
...screen_keyboard_display_manager_tab_tip.cc | 5 +-
...creen_keyboard_display_manager_unittest.cc | 4 +
ui/base/ime/win/tsf_input_scope.cc | 12 +-
ui/base/ime/win/tsf_input_scope_unittest.cc | 3 +
ui/base/pointer/touch_ui_controller.cc | 4 +-
ui/base/ui_base_features.cc | 7 +-
ui/base/ui_base_switches.cc | 3 +
ui/base/ui_base_switches.h | 1 +
ui/base/win/lock_state.cc | 10 +-
ui/base/win/shell.cc | 31 +-
ui/base/win/shell.h | 15 +-
ui/color/win/accent_color_observer.cc | 40 +-
ui/display/win/uwp_text_scale_factor.cc | 14 +-
ui/gfx/font_fallback_unittest.cc | 13 +
ui/gfx/font_fallback_win_unittest.cc | 5 +
ui/gfx/render_text.cc | 40 +-
ui/gfx/render_text_unittest.cc | 20 +-
ui/gfx/test/font_fallback_test_data.cc | 118 ++-
ui/gfx/test/font_fallback_test_data.h | 6 +-
ui/gfx/win/direct_write.cc | 32 +-
ui/gl/direct_composition_child_surface_win.cc | 5 +-
ui/message_center/views/message_view.cc | 6 +-
ui/native_theme/caption_style_win.cc | 8 +-
ui/native_theme/caption_style_win_unittest.cc | 33 +-
ui/platform_window/win/win_window.cc | 7 +-
.../select_file_dialog_win_unittest.cc | 5 +
ui/snapshot/snapshot_aura_unittest.cc | 56 +-
ui/snapshot/snapshot_win.cc | 30 +-
ui/views/BUILD.gn | 8 +
ui/views/bubble/bubble_border.cc | 38 +-
ui/views/bubble/bubble_border.h | 9 +-
ui/views/bubble/bubble_border_unittest.cc | 3 +-
.../bubble/bubble_dialog_delegate_view.cc | 23 +-
.../bubble_dialog_delegate_view_unittest.cc | 18 +-
ui/views/bubble/bubble_frame_view_unittest.cc | 16 +-
ui/views/corewm/cursor_height_provider_win.cc | 178 ++++
ui/views/corewm/cursor_height_provider_win.h | 21 +
ui/views/corewm/tooltip_win.cc | 186 +++++
ui/views/corewm/tooltip_win.h | 92 +++
ui/views/examples/bubble_example.cc | 7 +-
ui/views/examples/bubble_example.h | 1 +
.../desktop_window_tree_host_win.cc | 26 +-
.../desktop_window_tree_host_win.h | 11 +
ui/views/widget/widget_hwnd_utils.cc | 15 +-
ui/views/widget/widget_interactive_uitest.cc | 6 +
ui/views/win/fullscreen_handler.cc | 7 +
ui/views/win/hwnd_message_handler.cc | 119 ++-
ui/views/win/hwnd_message_handler.h | 11 +
ui/views/win/hwnd_message_handler_delegate.h | 5 +
ui/views/window/dialog_delegate.cc | 9 +
447 files changed, 8971 insertions(+), 1502 deletions(-)
create mode 100644 content/browser/renderer_host/dwrite_font_lookup_table_builder_win.cc
create mode 100644 content/browser/renderer_host/dwrite_font_lookup_table_builder_win.h
create mode 100644 content/browser/renderer_host/dwrite_font_lookup_table_builder_win_unittest.cc
create mode 100644 content/test/data/accessibility/aom/aom-live-region-expected-uia-win7.txt
create mode 100644 content/test/data/accessibility/aom/aom-modal-dialog-expected-uia-win7.txt
create mode 100644 content/test/data/accessibility/aria/aria-contentinfo-expected-uia-win7.txt
create mode 100644 content/test/data/accessibility/aria/aria-describedby-expected-uia-win7.txt
create mode 100644 content/test/data/accessibility/aria/aria-description-expected-uia-win7.txt
create mode 100644 content/test/data/accessibility/aria/aria-details-multiple-expected-uia-win7.txt
create mode 100644 content/test/data/accessibility/aria/aria-tree-discontinuous-expected-uia-win7.txt
create mode 100644 content/test/data/accessibility/aria/aria-treegrid-expected-uia-win7.txt
create mode 100644 content/test/data/accessibility/event/add-alert-content-expected-uia-win7.txt
create mode 100644 content/test/data/accessibility/event/add-dialog-described-by-expected-uia-win7.txt
create mode 100644 content/test/data/accessibility/event/add-dialog-expected-uia-win7.txt
create mode 100644 content/test/data/accessibility/event/add-dialog-no-info-expected-uia-win7.txt
create mode 100644 content/test/data/accessibility/event/aria-combo-box-collapse-expected-uia-win7.txt
create mode 100644 content/test/data/accessibility/event/aria-flow-to-expected-uia-win7.txt
create mode 100644 content/test/data/accessibility/event/aria-level-changed-expected-uia-win7.txt
create mode 100644 content/test/data/accessibility/event/aria-live-changed-expected-uia-win7.txt
create mode 100644 content/test/data/accessibility/event/aria-posinset-changed-expected-uia-win7.txt
create mode 100644 content/test/data/accessibility/event/aria-setsize-changed-expected-uia-win7.txt
create mode 100644 content/test/data/accessibility/event/description-change-expected-uia-win7.txt
create mode 100644 content/test/data/accessibility/event/description-change-indirect-expected-uia-win7.txt
create mode 100644 content/test/data/accessibility/event/live-region-add-expected-uia-win7.txt
create mode 100644 content/test/data/accessibility/event/live-region-add-live-attribute-expected-uia-win7.txt
create mode 100644 content/test/data/accessibility/event/live-region-change-expected-uia-win7.txt
create mode 100644 content/test/data/accessibility/event/menubar-show-hide-menus-expected-uia-win7.txt
create mode 100644 content/test/data/accessibility/event/menulist-collapse-expected-uia-win7.txt
create mode 100644 content/test/data/accessibility/event/menulist-collapse-next-expected-uia-win7.txt
create mode 100644 content/test/data/accessibility/event/visibility-hidden-changed-expected-uia-win7.txt
create mode 100644 content/test/data/accessibility/html/a-name-calc-expected-uia-win7.txt
create mode 100644 content/test/data/accessibility/html/button-name-calc-expected-uia-win7.txt
create mode 100644 content/test/data/accessibility/html/footer-expected-uia-win7.txt
create mode 100644 content/test/data/accessibility/html/input-date-with-popup-open-expected-uia-win7.txt
create mode 100644 content/test/data/accessibility/html/list-item-aria-setsize-unknown-expected-uia-win7.txt
create mode 100644 content/test/data/accessibility/html/list-item-aria-setsize-unknown-flattened-expected-uia-win7.txt
create mode 100644 content/test/data/accessibility/html/output-expected-uia-win7.txt
create mode 100644 third_party/blink/common/dwrite_rasterizer_support/dwrite_rasterizer_support.cc
create mode 100644 third_party/blink/public/common/dwrite_rasterizer_support/dwrite_rasterizer_support.h
create mode 160000 third_party/centipede/src
create mode 160000 third_party/cros-components/src
create mode 160000 third_party/crossbench
create mode 100644 ui/views/corewm/cursor_height_provider_win.cc
create mode 100644 ui/views/corewm/cursor_height_provider_win.h
create mode 100644 ui/views/corewm/tooltip_win.cc
create mode 100644 ui/views/corewm/tooltip_win.h
diff --git a/base/allocator/partition_allocator/address_space_randomization.cc b/base/allocator/partition_allocator/address_space_randomization.cc
index dcaa8d3b2e282..907853ef216f4 100644
--- a/base/allocator/partition_allocator/address_space_randomization.cc
+++ b/base/allocator/partition_allocator/address_space_randomization.cc
@@ -10,7 +10,9 @@
#include "build/build_config.h"
#if BUILDFLAG(IS_WIN)
-#include <windows.h>
+#include <windows.h> // Must be in front of other Windows header files.
+
+#include <versionhelpers.h>
#endif
namespace partition_alloc {
@@ -22,10 +24,26 @@ uintptr_t GetRandomPageBase() {
random <<= 32ULL;
random |= static_cast<uintptr_t>(internal::RandomValue());
- // The ASLRMask() and ASLROffset() constants will be suitable for the
- // OS and build configuration.
+// The ASLRMask() and ASLROffset() constants will be suitable for the
+// OS and build configuration.
+#if BUILDFLAG(IS_WIN) && !defined(MEMORY_TOOL_REPLACES_ALLOCATOR)
+ // Windows >= 8.1 has the full 47 bits. Use them where available.
+ static bool windows_81 = false;
+ static bool windows_81_initialized = false;
+ if (!windows_81_initialized) {
+ windows_81 = IsWindows8Point1OrGreater();
+ windows_81_initialized = true;
+ }
+ if (!windows_81) {
+ random &= internal::ASLRMaskBefore8_10();
+ } else {
+ random &= internal::ASLRMask();
+ }
+ random += internal::ASLROffset();
+#else
random &= internal::ASLRMask();
random += internal::ASLROffset();
+#endif // BUILDFLAG(IS_WIN) && !defined(MEMORY_TOOL_REPLACES_ALLOCATOR)
#else // PA_CONFIG(HAS_64_BITS_POINTERS)
#if BUILDFLAG(IS_WIN)
// On win32 host systems the randomization plus huge alignment causes
diff --git a/base/allocator/partition_allocator/address_space_randomization.h b/base/allocator/partition_allocator/address_space_randomization.h
index e4767ca7bd394..e76125677f17e 100644
--- a/base/allocator/partition_allocator/address_space_randomization.h
+++ b/base/allocator/partition_allocator/address_space_randomization.h
@@ -56,12 +56,16 @@ AslrMask(uintptr_t bits) {
#elif BUILDFLAG(IS_WIN)
- // Windows 8.10 and newer support the full 48 bit address range. Since
- // ASLROffset() is non-zero and may cause a carry, use 47 bit masks. See
+ // Windows 8.10 and newer support the full 48 bit address range. Older
+ // versions of Windows only support 44 bits. Since ASLROffset() is non-zero
+ // and may cause a carry, use 47 and 43 bit masks. See
// http://www.alex-ionescu.com/?p=246
constexpr PA_ALWAYS_INLINE uintptr_t ASLRMask() {
return AslrMask(47);
}
+ constexpr PA_ALWAYS_INLINE uintptr_t ASLRMaskBefore8_10() {
+ return AslrMask(43);
+ }
// Try not to map pages into the range where Windows loads DLLs by default.
constexpr PA_ALWAYS_INLINE uintptr_t ASLROffset() {
return 0x80000000ULL;
diff --git a/base/allocator/partition_allocator/address_space_randomization_unittest.cc b/base/allocator/partition_allocator/address_space_randomization_unittest.cc
index 196e7e3d1976d..d8211de8d6a69 100644
--- a/base/allocator/partition_allocator/address_space_randomization_unittest.cc
+++ b/base/allocator/partition_allocator/address_space_randomization_unittest.cc
@@ -17,6 +17,8 @@
#if BUILDFLAG(IS_WIN)
#include <windows.h>
#include "base/win/windows_version.h"
+// versionhelpers.h must be included after windows.h.
+#include <versionhelpers.h>
#endif
namespace partition_alloc {
@@ -26,6 +28,12 @@ namespace {
uintptr_t GetMask() {
uintptr_t mask = internal::ASLRMask();
#if defined(ARCH_CPU_64_BITS)
+// Sanitizers use their own ASLR mask constant.
+#if BUILDFLAG(IS_WIN) && !defined(MEMORY_TOOL_REPLACES_ALLOCATOR)
+ if (!IsWindows8Point1OrGreater()) {
+ mask = internal::ASLRMaskBefore8_10();
+ }
+#endif // BUILDFLAG(IS_WIN) && !defined(MEMORY_TOOL_REPLACES_ALLOCATOR))
#elif defined(ARCH_CPU_32_BITS)
#if BUILDFLAG(IS_WIN)
BOOL is_wow64 = FALSE;
diff --git a/base/allocator/partition_allocator/page_allocator_internals_win.h b/base/allocator/partition_allocator/page_allocator_internals_win.h
index 7c73ccda1500e..f3bb11989a44d 100644
--- a/base/allocator/partition_allocator/page_allocator_internals_win.h
+++ b/base/allocator/partition_allocator/page_allocator_internals_win.h
@@ -5,6 +5,8 @@
#ifndef BASE_ALLOCATOR_PARTITION_ALLOCATOR_PAGE_ALLOCATOR_INTERNALS_WIN_H_
#define BASE_ALLOCATOR_PARTITION_ALLOCATOR_PAGE_ALLOCATOR_INTERNALS_WIN_H_
+#include <versionhelpers.h>
+
#include <cstdint>
#include "base/allocator/partition_allocator/oom.h"
@@ -16,6 +18,17 @@
namespace partition_alloc::internal {
+namespace {
+
+// On Windows, discarded pages are not returned to the system immediately and
+// not guaranteed to be zeroed when returned to the application.
+using DiscardVirtualMemoryFunction = DWORD(WINAPI*)(PVOID virtualAddress,
+ SIZE_T size);
+DiscardVirtualMemoryFunction s_discard_virtual_memory =
+ reinterpret_cast<DiscardVirtualMemoryFunction>(-1);
+
+} // namespace
+
// |VirtualAlloc| will fail if allocation at the hint address is blocked.
constexpr bool kHintIsAdvisory = false;
std::atomic<int32_t> s_allocPageErrorCode{ERROR_SUCCESS};
@@ -224,10 +237,27 @@ bool TryRecommitSystemPagesInternal(
}
void DiscardSystemPagesInternal(uintptr_t address, size_t length) {
+ if (s_discard_virtual_memory ==
+ reinterpret_cast<DiscardVirtualMemoryFunction>(-1)) {
+ // DiscardVirtualMemory's minimum supported client is Windows 8.1 Update.
+ // So skip GetProcAddress("DiscardVirtualMemory") if windows version is
+ // smaller than Windows 8.1.
+ if (IsWindows8Point1OrGreater()) {
+ s_discard_virtual_memory =
+ reinterpret_cast<DiscardVirtualMemoryFunction>(GetProcAddress(
+ GetModuleHandle(L"Kernel32.dll"), "DiscardVirtualMemory"));
+ } else {
+ s_discard_virtual_memory = nullptr;
+ }
+ }
+
void* ptr = reinterpret_cast<void*>(address);
// Use DiscardVirtualMemory when available because it releases faster than
// MEM_RESET.
- DWORD ret = DiscardVirtualMemory(ptr, length);
+ DWORD ret = 1;
+ if (s_discard_virtual_memory) {
+ ret = s_discard_virtual_memory(ptr, length);
+ }
// DiscardVirtualMemory is buggy in Win10 SP0, so fall back to MEM_RESET on
// failure.
if (ret) {
diff --git a/base/base_paths_win.cc b/base/base_paths_win.cc
index 3ac45e74666f7..605ad1152386d 100644
--- a/base/base_paths_win.cc
+++ b/base/base_paths_win.cc
@@ -146,6 +146,9 @@ bool PathProviderWin(int key, FilePath* result) {
break;
}
case base::DIR_APP_SHORTCUTS: {
+ if (win::GetVersion() < win::Version::WIN8)
+ return false;
+
base::win::ScopedCoMem<wchar_t> path_buf;
if (FAILED(SHGetKnownFolderPath(FOLDERID_ApplicationShortcuts, 0, NULL,
&path_buf)))
diff --git a/base/debug/invalid_access_win.cc b/base/debug/invalid_access_win.cc
index dc0d54bbc67ec..246e8e4775a43 100644
--- a/base/debug/invalid_access_win.cc
+++ b/base/debug/invalid_access_win.cc
@@ -9,6 +9,7 @@
#include <windows.h>
#include "base/check.h"
+#include "base/win/windows_version.h"
#include "build/build_config.h"
namespace base {
@@ -41,10 +42,21 @@ void IndirectCall(FuncType* func) {
(*func)();
}
+void CreateSyntheticHeapCorruption() {
+ EXCEPTION_RECORD record = {};
+ record.ExceptionCode = STATUS_HEAP_CORRUPTION;
+ RaiseFailFastException(&record, nullptr,
+ FAIL_FAST_GENERATE_EXCEPTION_ADDRESS);
+}
+
} // namespace
void TerminateWithHeapCorruption() {
__try {
+ // Pre-Windows 10, it's hard to trigger a heap corruption fast fail, so
+ // artificially create one instead.
+ if (base::win::GetVersion() < base::win::Version::WIN10)
+ CreateSyntheticHeapCorruption();
HANDLE heap = ::HeapCreate(0, 0, 0);
CHECK(heap);
CHECK(HeapSetInformation(heap, HeapEnableTerminationOnCorruption, nullptr,
diff --git a/base/files/file_util_win.cc b/base/files/file_util_win.cc
index c84124e3494b9..e8d15763c5e31 100644
--- a/base/files/file_util_win.cc
+++ b/base/files/file_util_win.cc
@@ -1059,18 +1059,44 @@ bool SetNonBlocking(int fd) {
return false;
}
+namespace {
+
+// ::PrefetchVirtualMemory() is only available on Windows 8 and above. Chrome
+// supports Windows 7, so we need to check for the function's presence
+// dynamically.
+using PrefetchVirtualMemoryPtr = decltype(&::PrefetchVirtualMemory);
+
+// Returns null if ::PrefetchVirtualMemory() is not available.
+PrefetchVirtualMemoryPtr GetPrefetchVirtualMemoryPtr() {
+ HMODULE kernel32_dll = ::GetModuleHandleA("kernel32.dll");
+ return reinterpret_cast<PrefetchVirtualMemoryPtr>(
+ GetProcAddress(kernel32_dll, "PrefetchVirtualMemory"));
+}
+
+} // namespace
+
bool PreReadFile(const FilePath& file_path,
bool is_executable,
int64_t max_bytes) {
DCHECK_GE(max_bytes, 0);
+ // On Win8 and higher use ::PrefetchVirtualMemory(). This is better than a
+ // simple data file read, more from a RAM perspective than CPU. This is
+ // because reading the file as data results in double mapping to
+ // Image/executable pages for all pages of code executed.
+ static PrefetchVirtualMemoryPtr prefetch_virtual_memory =
+ GetPrefetchVirtualMemoryPtr();
+
+ if (prefetch_virtual_memory == nullptr)
+ return internal::PreReadFileSlow(file_path, max_bytes);
+
if (max_bytes == 0) {
- // ::PrefetchVirtualMemory() fails when asked to read zero bytes.
+ // PrefetchVirtualMemory() fails when asked to read zero bytes.
// base::MemoryMappedFile::Initialize() fails on an empty file.
return true;
}
- // ::PrefetchVirtualMemory() fails if the file is opened with write access.
+ // PrefetchVirtualMemory() fails if the file is opened with write access.
MemoryMappedFile::Access access = is_executable
? MemoryMappedFile::READ_CODE_IMAGE
: MemoryMappedFile::READ_ONLY;
@@ -1082,11 +1108,7 @@ bool PreReadFile(const FilePath& file_path,
std::min(base::saturated_cast<::SIZE_T>(max_bytes),
base::saturated_cast<::SIZE_T>(mapped_file.length()));
::_WIN32_MEMORY_RANGE_ENTRY address_range = {mapped_file.data(), length};
- // Use ::PrefetchVirtualMemory(). This is better than a
- // simple data file read, more from a RAM perspective than CPU. This is
- // because reading the file as data results in double mapping to
- // Image/executable pages for all pages of code executed.
- if (!::PrefetchVirtualMemory(::GetCurrentProcess(),
+ if (!prefetch_virtual_memory(::GetCurrentProcess(),
/*NumberOfEntries=*/1, &address_range,
/*Flags=*/0)) {
return internal::PreReadFileSlow(file_path, max_bytes);
diff --git a/base/memory/discardable_shared_memory.cc b/base/memory/discardable_shared_memory.cc
index 23c95bad719c7..62a0b3c1f1d17 100644
--- a/base/memory/discardable_shared_memory.cc
+++ b/base/memory/discardable_shared_memory.cc
@@ -422,11 +422,23 @@ bool DiscardableSharedMemory::Purge(Time current_time) {
#elif BUILDFLAG(IS_WIN)
// On Windows, discarded pages are not returned to the system immediately and
// not guaranteed to be zeroed when returned to the application.
+ using DiscardVirtualMemoryFunction =
+ DWORD(WINAPI*)(PVOID virtualAddress, SIZE_T size);
+ static DiscardVirtualMemoryFunction discard_virtual_memory =
+ reinterpret_cast<DiscardVirtualMemoryFunction>(GetProcAddress(
+ GetModuleHandle(L"Kernel32.dll"), "DiscardVirtualMemory"));
+
char* address = static_cast<char*>(shared_memory_mapping_.memory()) +
AlignToPageSize(sizeof(SharedState));
size_t length = AlignToPageSize(mapped_size_);
- DWORD ret = DiscardVirtualMemory(address, length);
+ // Use DiscardVirtualMemory when available because it releases faster than
+ // MEM_RESET.
+ DWORD ret = ERROR_NOT_SUPPORTED;
+ if (discard_virtual_memory) {
+ ret = discard_virtual_memory(address, length);
+ }
+
// DiscardVirtualMemory is buggy in Win10 SP0, so fall back to MEM_RESET on
// failure.
if (ret != ERROR_SUCCESS) {
diff --git a/base/memory/platform_shared_memory_region_win.cc b/base/memory/platform_shared_memory_region_win.cc
index e387015249731..bdf62a3e0c9c9 100644
--- a/base/memory/platform_shared_memory_region_win.cc
+++ b/base/memory/platform_shared_memory_region_win.cc
@@ -14,9 +14,14 @@
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/process/process_handle.h"
+#include "base/rand_util.h"
#include "base/strings/string_util.h"
+#include "base/strings/stringprintf.h"
+#include "base/strings/utf_string_conversions.h"
+#include "base/win/windows_version.h"
-namespace base::subtle {
+namespace base {
+namespace subtle {
namespace {
@@ -211,6 +216,18 @@ PlatformSharedMemoryRegion PlatformSharedMemoryRegion::Create(Mode mode,
}
std::u16string name;
+ if (win::GetVersion() < win::Version::WIN8_1) {
+ // Windows < 8.1 ignores DACLs on certain unnamed objects (like shared
+ // sections). So, we generate a random name when we need to enforce
+ // read-only.
+ uint64_t rand_values[4];
+ RandBytes(&rand_values, sizeof(rand_values));
+ name = ASCIIToUTF16(StringPrintf("CrSharedMem_%016llx%016llx%016llx%016llx",
+ rand_values[0], rand_values[1],
+ rand_values[2], rand_values[3]));
+ DCHECK(!name.empty());
+ }
+
SECURITY_ATTRIBUTES sa = {sizeof(sa), &sd, FALSE};
// Ask for the file mapping with reduced permisions to avoid passing the
// access control permissions granted by default into unpriviledged process.
@@ -267,4 +284,5 @@ PlatformSharedMemoryRegion::PlatformSharedMemoryRegion(
const UnguessableToken& guid)
: handle_(std::move(handle)), mode_(mode), size_(size), guid_(guid) {}
-} // namespace base::subtle
+} // namespace subtle
+} // namespace base
diff --git a/base/path_service_unittest.cc b/base/path_service_unittest.cc
index 4cd5ecb9a07af..3bbaf21dfd10b 100644
--- a/base/path_service_unittest.cc
+++ b/base/path_service_unittest.cc
@@ -142,7 +142,14 @@ TEST_F(PathServiceTest, Get) {
}
#if BUILDFLAG(IS_WIN)
for (int key = PATH_WIN_START + 1; key < PATH_WIN_END; ++key) {
- EXPECT_PRED1(ReturnsValidPath, key);
+ bool valid = true;
+ if (key == DIR_APP_SHORTCUTS)
+ valid = base::win::GetVersion() >= base::win::Version::WIN8;
+
+ if (valid)
+ EXPECT_PRED1(ReturnsValidPath, key);
+ else
+ EXPECT_PRED1(ReturnsInvalidPath, key);
}
#elif BUILDFLAG(IS_APPLE)
for (int key = PATH_MAC_START + 1; key < PATH_MAC_END; ++key) {
diff --git a/base/process/launch_win.cc b/base/process/launch_win.cc
index 615d74d1d4b5a..8ac7002543e95 100644
--- a/base/process/launch_win.cc
+++ b/base/process/launch_win.cc
@@ -349,6 +349,15 @@ Process LaunchProcess(const CommandLine::StringType& cmdline,
startup_info->hStdError = options.stderr_handle;
}
+ if (options.job_handle) {
+ // If this code is run under a debugger, the launched process is
+ // automatically associated with a job object created by the debugger.
+ // The CREATE_BREAKAWAY_FROM_JOB flag is used to prevent this on Windows
+ // releases that do not support nested jobs.
+ if (win::GetVersion() < win::Version::WIN8)
+ flags |= CREATE_BREAKAWAY_FROM_JOB;
+ }
+
if (options.force_breakaway_from_job_)
flags |= CREATE_BREAKAWAY_FROM_JOB;
diff --git a/base/process/process_unittest.cc b/base/process/process_unittest.cc
index ae7b17bfa4f04..5077df915b448 100644
--- a/base/process/process_unittest.cc
+++ b/base/process/process_unittest.cc
@@ -4,7 +4,6 @@
#include "base/process/process.h"
-#include <string>
#include <utility>
#include "base/at_exit.h"
@@ -36,6 +35,7 @@
#if BUILDFLAG(IS_WIN)
#include "base/win/base_win_buildflags.h"
+#include "base/win/windows_version.h"
#include <windows.h>
#endif
@@ -91,8 +91,7 @@ std::string GetProcessCpuCgroup(const base::Process& process) {
return std::string();
}
-bool AddProcessToCpuCgroup(const base::Process& process,
- const std::string& cgroup) {
+bool AddProcessToCpuCgroup(const base::Process& process, std::string& cgroup) {
base::FilePath path(cgroup);
path = path.Append("cgroup.procs");
return base::WriteFile(path, base::NumberToString(process.Pid()));
@@ -412,6 +411,9 @@ TEST_F(ProcessTest, MAYBE_HeapCorruption) {
#define MAYBE_ControlFlowViolation DISABLED_ControlFlowViolation
#endif
TEST_F(ProcessTest, MAYBE_ControlFlowViolation) {
+ // CFG is only supported on Windows 8.1 or greater.
+ if (base::win::GetVersion() < base::win::Version::WIN8_1)
+ return;
// CFG causes ntdll!RtlFailFast2 to be called resulting in uncatchable
// 0xC0000409 (STATUS_STACK_BUFFER_OVERRUN) exception.
EXPECT_EXIT(base::debug::win::TerminateWithControlFlowViolation(),
diff --git a/base/process/process_win.cc b/base/process/process_win.cc
index a92fe6d1a6556..074992ff8c0ff 100644
--- a/base/process/process_win.cc
+++ b/base/process/process_win.cc
@@ -292,11 +292,17 @@ bool Process::SetProcessBackgrounded(bool value) {
power_throttling.ControlMask = 0;
power_throttling.StateMask = 0;
}
- bool ret =
- ::SetProcessInformation(Handle(), ProcessPowerThrottling,
- &power_throttling, sizeof(power_throttling));
- if (ret == 0) {
- DPLOG(ERROR) << "Setting process QoS policy fails";
+
+ static const auto set_process_information_fn =
+ reinterpret_cast<decltype(&::SetProcessInformation)>(::GetProcAddress(
+ ::GetModuleHandle(L"Kernel32.dll"), "SetProcessInformation"));
+ if (set_process_information_fn) {
+ bool ret =
+ set_process_information_fn(Handle(), ProcessPowerThrottling,
+ &power_throttling, sizeof(power_throttling));
+ if (ret == 0) {
+ DPLOG(ERROR) << "Setting process QoS policy fails";
+ }
}
}
diff --git a/base/task/thread_pool/thread_group.cc b/base/task/thread_pool/thread_group.cc
index 8eb2e951139b6..bc8199344a519 100644
--- a/base/task/thread_pool/thread_group.cc
+++ b/base/task/thread_pool/thread_group.cc
@@ -17,7 +17,9 @@
#if BUILDFLAG(IS_WIN)
#include "base/win/com_init_check_hook.h"
+#include "base/win/scoped_com_initializer.h"
#include "base/win/scoped_winrt_initializer.h"
+#include "base/win/windows_version.h"
#endif
namespace base {
@@ -325,8 +327,18 @@ bool ThreadGroup::ShouldYield(TaskSourceSortKey sort_key) {
std::unique_ptr<win::ScopedWindowsThreadEnvironment>
ThreadGroup::GetScopedWindowsThreadEnvironment(WorkerEnvironment environment) {
std::unique_ptr<win::ScopedWindowsThreadEnvironment> scoped_environment;
- if (environment == WorkerEnvironment::COM_MTA) {
- scoped_environment = std::make_unique<win::ScopedWinrtInitializer>();
+ switch (environment) {
+ case WorkerEnvironment::COM_MTA: {
+ if (win::GetVersion() >= win::Version::WIN8) {
+ scoped_environment = std::make_unique<win::ScopedWinrtInitializer>();
+ } else {
+ scoped_environment = std::make_unique<win::ScopedCOMInitializer>(
+ win::ScopedCOMInitializer::kMTA);
+ }
+ break;
+ }
+ default:
+ break;
}
DCHECK(!scoped_environment || scoped_environment->Succeeded());
diff --git a/base/test/launcher/test_launcher.cc b/base/test/launcher/test_launcher.cc
index 98aaabe3be113..f1966015cb690 100644
--- a/base/test/launcher/test_launcher.cc
+++ b/base/test/launcher/test_launcher.cc
@@ -78,6 +78,7 @@
#if BUILDFLAG(IS_WIN)
#include "base/strings/string_util_win.h"
+#include "base/win/windows_version.h"
#include <windows.h>
@@ -97,8 +98,7 @@
namespace base {
-// See