[heap profiler] Update flag desriptions to match the current state.

Also retire --memlog-sampling flag as it is always enabled.
Add description for --memlog-in-process flag.

BUG=923459

Change-Id: Ibea239b2344872df67b649f2dc9cbc0ba347bc32
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1507197
Reviewed-by: Elly Fong-Jones <[email protected]>
Reviewed-by: Stephen Chenney <[email protected]>
Reviewed-by: Erik Chen <[email protected]>
Commit-Queue: Alexei Filippov <[email protected]>
Cr-Commit-Position: refs/heads/master@{#638759}
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index 9e163e1..3a6de2d 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -2784,9 +2784,15 @@
          kOutOfProcessHeapProfilingKeepSmallAllocationsDescription,
      kOsAll, SINGLE_VALUE_TYPE(heap_profiling::kMemlogKeepSmallAllocations)},
 
-    {"memlog-sampling", flag_descriptions::kOutOfProcessHeapProfilingSampling,
-     flag_descriptions::kOutOfProcessHeapProfilingSamplingDescription, kOsAll,
-     SINGLE_VALUE_TYPE(heap_profiling::kMemlogSampling)},
+    {"memlog-in-process",
+     flag_descriptions::kOutOfProcessHeapProfilingInProcess,
+     flag_descriptions::kOutOfProcessHeapProfilingInProcessDescription, kOsAll,
+     SINGLE_VALUE_TYPE(heap_profiling::kMemlogInProcess)},
+
+    {"memlog-sampling-rate",
+     flag_descriptions::kOutOfProcessHeapProfilingSamplingRate,
+     flag_descriptions::kOutOfProcessHeapProfilingSamplingRateDescription,
+     kOsAll, SINGLE_VALUE_TYPE(heap_profiling::kMemlogSamplingRate)},
 
     {"memlog-stack-mode", flag_descriptions::kOOPHPStackModeName,
      flag_descriptions::kOOPHPStackModeDescription, kOsAll,
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json
index 1cc4e2d..d8c4cc7a 100644
--- a/chrome/browser/flag-metadata.json
+++ b/chrome/browser/flag-metadata.json
@@ -2269,7 +2269,16 @@
     "expiry_milestone": -1
   },
   {
-    "name": "memlog-sampling",
+    "name": "memlog-in-process",
+    "owners": [ "erikchen", "ssid", "etienneb", "alph" ],
+    // Memlog is Chrome's heap profiler. It is used for both automated and
+    // manual performance analysis. This flag allows a user or developer to
+    // capture a memlog without disturbing the situation under test by
+    // restarting to apply a switch. It should not be removed.
+    "expiry_milestone": -1
+  },
+  {
+    "name": "memlog-sampling-rate",
     "owners": [ "erikchen", "ssid", "etienneb", "alph" ],
     // Memlog is Chrome's heap profiler. It is used for both automated and
     // manual performance analysis. This flag allows a user or developer to
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc
index 9eecb8d0..a062e6ca 100644
--- a/chrome/browser/flag_descriptions.cc
+++ b/chrome/browser/flag_descriptions.cc
@@ -763,10 +763,12 @@
     "with hit-test data computed from the CompositorFrame.";
 
 const char kEnableOutOfProcessHeapProfilingName[] =
-    "Out of process heap profiling start mode.";
+    "Chrome heap profiling start mode.";
 const char kEnableOutOfProcessHeapProfilingDescription[] =
-    "Creates a profiling service that records stacktraces for all live, "
-    "malloced objects. Heap dumps can be obtained at chrome://tracing "
+    "Starts heap profiling service that records sampled memory allocation "
+    "profile having each sample attributed with a callstack. "
+    "The sampling resolution is controlled with --memlog-sampling flag. "
+    "Recorded heap dumps can be obtained at chrome://tracing "
     "[category:memory-infra] and chrome://memory-internals. This setting "
     "controls which processes are profiled. As long as this setting is not "
     "disabled, users can start profiling any given process in "
@@ -783,8 +785,14 @@
     "Profile a random sampling of renderer processes, ensuring only one is "
     "ever profiled at a time.";
 
+const char kOutOfProcessHeapProfilingInProcess[] =
+    "Run the heap profiling service in the browser process.";
+const char kOutOfProcessHeapProfilingInProcessDescription[] =
+    "Makes profiling service (if enabled) to be executed within the browser "
+    "process. By default the service is run in a dedicated utility process.";
+
 const char kOutOfProcessHeapProfilingKeepSmallAllocations[] =
-    "Emit small allocations in memlog heap dumps.";
+    "Emit small allocations in memlog heap dumps (deprecated).";
 const char kOutOfProcessHeapProfilingKeepSmallAllocationsDescription[] =
     "By default, small allocations are pruned from the heap dump. This reduces "
     "the size of the compressed trace by 100x. If pruning is disabled, the "
@@ -794,11 +802,12 @@
     "automatically uploaded traces will always be pruned. This only affects "
     "manually taken memory-infra traces.";
 
-const char kOutOfProcessHeapProfilingSampling[] = "Sample memlog allocations";
-const char kOutOfProcessHeapProfilingSamplingDescription[] =
-    "Use a poisson process to sample allocations. Defaults to a sample rate of "
-    "10000. This results in low noise for large and/or frequent allocations ["
-    "[size * frequency >> 10000]. This means that aggregate numbers [e.g. "
+const char kOutOfProcessHeapProfilingSamplingRate[] =
+    "Sampling interval in bytes for memlog allocations.";
+const char kOutOfProcessHeapProfilingSamplingRateDescription[] =
+    "Use a poisson process to sample allocations. Defaults to a sampling rate "
+    "of 100KB. This results in low noise for large and/or frequent allocations "
+    "[size * frequency >> 100KB]. This means that aggregate numbers [e.g. "
     "total size of malloc-ed objects] and large and/or frequent allocations "
     "can be trusted with high fidelity.";
 
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h
index 9c0eba86..1389e971 100644
--- a/chrome/browser/flag_descriptions.h
+++ b/chrome/browser/flag_descriptions.h
@@ -474,8 +474,10 @@
 extern const char kEnableOutOfProcessHeapProfilingModeRendererSampling[];
 extern const char kOutOfProcessHeapProfilingKeepSmallAllocations[];
 extern const char kOutOfProcessHeapProfilingKeepSmallAllocationsDescription[];
-extern const char kOutOfProcessHeapProfilingSampling[];
-extern const char kOutOfProcessHeapProfilingSamplingDescription[];
+extern const char kOutOfProcessHeapProfilingInProcess[];
+extern const char kOutOfProcessHeapProfilingInProcessDescription[];
+extern const char kOutOfProcessHeapProfilingSamplingRate[];
+extern const char kOutOfProcessHeapProfilingSamplingRateDescription[];
 
 extern const char kOOPHPStackModeName[];
 extern const char kOOPHPStackModeDescription[];