renderer_process_metrics_provider.cc 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Copyright 2021 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "android_webview/browser/metrics/renderer_process_metrics_provider.h"
  5. #include "android_webview/common/aw_switches.h"
  6. #include "base/command_line.h"
  7. #include "base/metrics/histogram_functions.h"
  8. namespace {
  9. // These values are persisted to logs. Entries should not be renumbered and
  10. // numeric values should never be reused.
  11. enum SingleOrMultiProcess {
  12. kSingleProcess = 0,
  13. kMultiProcess = 1,
  14. kMaxValue = kMultiProcess,
  15. };
  16. void RecordRendererProcessMetricsImpl() {
  17. const base::CommandLine* command_line =
  18. base::CommandLine::ForCurrentProcess();
  19. DCHECK(command_line);
  20. bool multiProcess =
  21. command_line->HasSwitch(switches::kWebViewSandboxedRenderer);
  22. base::UmaHistogramEnumeration(
  23. "Android.WebView.SingleOrMultiProcess",
  24. static_cast<SingleOrMultiProcess>(multiProcess));
  25. }
  26. } // namespace
  27. namespace android_webview {
  28. void RendererProcessMetricsProvider::ProvideCurrentSessionData(
  29. metrics::ChromeUserMetricsExtension* uma_proto) {
  30. RecordRendererProcessMetricsImpl();
  31. }
  32. } // namespace android_webview