Code: ProfilingProcessHost::Mode ProfilingProcessHost::GetCurrentMode() {
  const base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess();
#if BUILDFLAG(USE_ALLOCATOR_SHIM)
  if (cmdline->HasSwitch(switches::kMemlog) ||
      base::FeatureList::IsEnabled(kOOPHeapProfilingFeature)) {
    if (cmdline->HasSwitch(switches::kEnableHeapProfiling)) {
      LOG(ERROR) << "--" << switches::kEnableHeapProfiling
                 << " specified with --" << switches::kMemlog
                 << "which are not compatible. Memlog will be disabled.";
      return Mode::kNone;
    }

    std::string mode;
    if (cmdline->HasSwitch(switches::kMemlog)) {
      mode = cmdline->GetSwitchValueASCII(switches::kMemlog);
    } else {
      mode = base::GetFieldTrialParamValueByFeature(
           kOOPHeapProfilingFeature, kOOPHeapProfilingFeatureMode);
     }
 
    if (mode == switches::kMemlogModeAll)
      return Mode::kAll;
    if (mode == switches::kMemlogModeMinimal)
      return Mode::kMinimal;
    if (mode == switches::kMemlogModeBrowser)
      return Mode::kBrowser;
    if (mode == switches::kMemlogModeGpu)
      return Mode::kGpu;
    if (mode == switches::kMemlogModeRendererSampling)
      return Mode::kRendererSampling;
    DLOG(ERROR) << "Unsupported value: \"" << mode << "\" passed to --"
                << switches::kMemlog;
   }
   return Mode::kNone;
 #else
  LOG_IF(ERROR, cmdline->HasSwitch(switches::kMemlog))
      << "--" << switches::kMemlog
      << " specified but it will have no effect because the use_allocator_shim "
      << "is not available in this build.";
  return Mode::kNone;
 #endif
 }

Vulnerability Type: 
CWE ID: CWE-416
Summary: Use after free in PDFium in Google Chrome prior to 63.0.3239.84 allowed a remote attacker to potentially exploit heap corruption via a crafted PDF file.
Commit Message: [Reland #1] Add Android OOP HP end-to-end tests.

The original CL added a javatest and its dependencies to the apk_under_test.
This causes the dependencies to be stripped from the instrumentation_apk, which
causes issue. This CL updates the build configuration so that the javatest and
its dependencies are only added to the instrumentation_apk.

This is a reland of e0b4355f0651adb1ebc2c513dc4410471af712f5
Original change's description:
> Add Android OOP HP end-to-end tests.
>
> This CL has three components:
>   1) The bulk of the logic in OOP HP was refactored into ProfilingTestDriver.
>   2) Adds a java instrumentation test, along with a JNI shim that forwards into
>   ProfilingTestDriver.
>   3) Creates a new apk: chrome_public_apk_for_test that contains the same
>   content as chrome_public_apk, as well as native files needed for (2).
>   chrome_public_apk_test now targets chrome_public_apk_for_test instead of
>   chrome_public_apk.
>
> Other ideas, discarded:
>   * Originally, I attempted to make the browser_tests target runnable on
>   Android. The primary problem is that native test harness cannot fork
>   or spawn processes. This is difficult to solve.
>
> More details on each of the components:
> (1) ProfilingTestDriver
>   * The TracingController test was migrated to use ProfilingTestDriver, but the
>   write-to-file test was left as-is. The latter behavior will likely be phased
>   out, but I'll clean that up in a future CL.
>   * gtest isn't supported for Android instrumentation tests. ProfilingTestDriver
>   has a single function RunTest that returns a 'bool' indicating success. On
>   failure, the class uses LOG(ERROR) to print the nature of the error. This will
>   cause the error to be printed out on browser_test error. On instrumentation
>   test failure, the error will be forwarded to logcat, which is available on all
>   infra bot test runs.
> (2) Instrumentation test
>   * For now, I only added a single test for the "browser" mode. Furthermore, I'm
>   only testing the start with command-line path.
> (3) New apk
>   * libchromefortest is a new shared library that contains all content from
>   libchrome, but also contains native sources for the JNI shim.
>   * chrome_public_apk_for_test is a new apk that contains all content from
>   chrome_public_apk, but uses a single shared library libchromefortest rather
>   than libchrome. This also contains java sources for the JNI shim.
>   * There is no way to just add a second shared library to chrome_public_apk
>   that just contains the native sources from the JNI shim without causing ODR
>   issues.
>   * chrome_public_test_apk now has apk_under_test = chrome_public_apk_for_test.
>   * There is no way to add native JNI sources as a shared library to
>   chrome_public_test_apk without causing ODR issues.
>
> Finally, this CL drastically increases the timeout to wait for native
> initialization. The previous timeout was 2 *
> CriteriaHelper.DEFAULT_MAX_TIME_TO_POLL, which flakily failed for this test.
> This suggests that this step/timeout is generally flaky. I increased the timeout
> to 20 * CriteriaHelper.DEFAULT_MAX_TIME_TO_POLL.
>
> Bug: 753218
> Change-Id: Ic224b7314fff57f1770a4048aa5753f54e040b55
> Reviewed-on: https://chromium-review.googlesource.com/770148
> Commit-Queue: Erik Chen <erikchen@chromium.org>
> Reviewed-by: John Budorick <jbudorick@chromium.org>
> Reviewed-by: Brett Wilson <brettw@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#517541}

Bug: 753218
TBR: brettw@chromium.org
Change-Id: Ic6aafb34c2467253f75cc85da48200d19f3bc9af
Reviewed-on: https://chromium-review.googlesource.com/777697
Commit-Queue: Erik Chen <erikchen@chromium.org>
Reviewed-by: John Budorick <jbudorick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#517850}