Persist histogram data when Chrome is running in the reduced mode.

Recently we noticed that the histogram data is lost when Chrome is
running in the reduced mode and get killed before the full browser
starts. This is because there isn't a SystemProfile set in the
reduced mode. Thus, the previous data in the BrowserMetrics-active.pma
file isn't picked up by Chrome the next time it is launched in the
full browser mode.

In this CL, we write the initial system profile to the mapped memory
file, so Chrome will pick up the data when it restarts in the full
browser mode.

Note: the histogram data is only persistent on the memory mapped file,
but not being uploaded when Chrome is running in the reduced mode.

Bug: 959854
Change-Id: Idc1cea6edfa854edf94f791f2df8a9ebb6a0af8e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1601307
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Brian White <bcwhite@chromium.org>
Commit-Queue: Xi Han <hanxi@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#662815}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 59bb8c2242cccd2ccad2e97ffeb566fbaf8b1179
5 files changed
tree: eb59b8dcf785896165ebfdd87d2d8b68afbbaea5
  1. BUILD.gn
  2. DEPS
  3. OWNERS
  4. README
  5. call_stack_profile_builder.cc
  6. call_stack_profile_builder.h
  7. call_stack_profile_builder_unittest.cc
  8. call_stack_profile_collector.cc
  9. call_stack_profile_collector.h
  10. call_stack_profile_encoding.cc
  11. call_stack_profile_encoding.h
  12. call_stack_profile_metrics_provider.cc
  13. call_stack_profile_metrics_provider.h
  14. call_stack_profile_metrics_provider_unittest.cc
  15. call_stack_profile_params.h
  16. child_call_stack_profile_collector.cc
  17. child_call_stack_profile_collector.h
  18. child_call_stack_profile_collector_unittest.cc
  19. clean_exit_beacon.cc
  20. clean_exit_beacon.h
  21. client_info.cc
  22. client_info.h
  23. cloned_install_detector.cc
  24. cloned_install_detector.h
  25. cloned_install_detector_unittest.cc
  26. component_metrics_provider.cc
  27. component_metrics_provider.h
  28. component_metrics_provider_unittest.cc
  29. cpu_metrics_provider.cc
  30. cpu_metrics_provider.h
  31. daily_event.cc
  32. daily_event.h
  33. daily_event_unittest.cc
  34. data_use_tracker.cc
  35. data_use_tracker.h
  36. data_use_tracker_unittest.cc
  37. delegating_provider.cc
  38. delegating_provider.h
  39. drive_metrics_provider.cc
  40. drive_metrics_provider.h
  41. drive_metrics_provider_android.cc
  42. drive_metrics_provider_fuchsia.cc
  43. drive_metrics_provider_ios.mm
  44. drive_metrics_provider_linux.cc
  45. drive_metrics_provider_mac.mm
  46. drive_metrics_provider_unittest.cc
  47. drive_metrics_provider_win.cc
  48. enabled_state_provider.cc
  49. enabled_state_provider.h
  50. environment_recorder.cc
  51. environment_recorder.h
  52. environment_recorder_unittest.cc
  53. expired_histogram_util.cc
  54. expired_histogram_util.h
  55. expired_histograms_checker.cc
  56. expired_histograms_checker.h
  57. expired_histograms_checker_unittest.cc
  58. field_trials_provider.cc
  59. field_trials_provider.h
  60. field_trials_provider_unittest.cc
  61. file_metrics_provider.cc
  62. file_metrics_provider.h
  63. file_metrics_provider_unittest.cc
  64. generate_expired_histograms_array.gni
  65. gpu/
  66. histogram_encoder.cc
  67. histogram_encoder.h
  68. histogram_encoder_unittest.cc
  69. log_decoder.cc
  70. log_decoder.h
  71. log_store.h
  72. machine_id_provider.h
  73. machine_id_provider_stub.cc
  74. machine_id_provider_win.cc
  75. machine_id_provider_win_unittest.cc
  76. metrics_log.cc
  77. metrics_log.h
  78. metrics_log_manager.cc
  79. metrics_log_manager.h
  80. metrics_log_manager_unittest.cc
  81. metrics_log_store.cc
  82. metrics_log_store.h
  83. metrics_log_store_unittest.cc
  84. metrics_log_unittest.cc
  85. metrics_log_uploader.h
  86. metrics_pref_names.cc
  87. metrics_pref_names.h
  88. metrics_provider.cc
  89. metrics_provider.h
  90. metrics_reporting_default_state.cc
  91. metrics_reporting_default_state.h
  92. metrics_reporting_service.cc
  93. metrics_reporting_service.h
  94. metrics_rotation_scheduler.cc
  95. metrics_rotation_scheduler.h
  96. metrics_scheduler.cc
  97. metrics_scheduler.h
  98. metrics_service.cc
  99. metrics_service.h
  100. metrics_service_accessor.cc
  101. metrics_service_accessor.h
  102. metrics_service_client.cc
  103. metrics_service_client.h
  104. metrics_service_unittest.cc
  105. metrics_state_manager.cc
  106. metrics_state_manager.h
  107. metrics_state_manager_unittest.cc
  108. metrics_switches.cc
  109. metrics_switches.h
  110. metrics_upload_scheduler.cc
  111. metrics_upload_scheduler.h
  112. net/
  113. persistent_histograms.cc
  114. persistent_histograms.h
  115. persistent_system_profile.cc
  116. persistent_system_profile.h
  117. persistent_system_profile_unittest.cc
  118. public/
  119. reporting_service.cc
  120. reporting_service.h
  121. reporting_service_unittest.cc
  122. serialization/
  123. single_sample_metrics.cc
  124. single_sample_metrics.h
  125. single_sample_metrics_factory_impl.cc
  126. single_sample_metrics_factory_impl.h
  127. single_sample_metrics_factory_impl_unittest.cc
  128. stability_metrics_helper.cc
  129. stability_metrics_helper.h
  130. stability_metrics_helper_unittest.cc
  131. stability_metrics_provider.cc
  132. stability_metrics_provider.h
  133. stability_metrics_provider_unittest.cc
  134. system_memory_stats_recorder.h
  135. system_memory_stats_recorder_linux.cc
  136. system_memory_stats_recorder_win.cc
  137. system_session_analyzer_win.cc
  138. system_session_analyzer_win.h
  139. system_session_analyzer_win_unittest.cc
  140. test_enabled_state_provider.cc
  141. test_enabled_state_provider.h
  142. test_metrics_log_uploader.cc
  143. test_metrics_log_uploader.h
  144. test_metrics_provider.cc
  145. test_metrics_provider.h
  146. test_metrics_service_client.cc
  147. test_metrics_service_client.h
  148. ui/
  149. unsent_log_store.cc
  150. unsent_log_store.h
  151. unsent_log_store_metrics.h
  152. unsent_log_store_metrics_impl.cc
  153. unsent_log_store_metrics_impl.h
  154. unsent_log_store_unittest.cc
  155. url_constants.cc
  156. url_constants.h
  157. version_utils.cc
  158. version_utils.h