You are here

public function ToolbarController::savePerformanceTimingAction in Devel 8

Same name and namespace in other branches
  1. 8.3 webprofiler/src/Controller/ToolbarController.php \Drupal\webprofiler\Controller\ToolbarController::savePerformanceTimingAction()
  2. 8.2 webprofiler/src/Controller/ToolbarController.php \Drupal\webprofiler\Controller\ToolbarController::savePerformanceTimingAction()
  3. 4.x webprofiler/src/Controller/ToolbarController.php \Drupal\webprofiler\Controller\ToolbarController::savePerformanceTimingAction()

Parameters

\Symfony\Component\HttpKernel\Profiler\Profile $profile:

\Symfony\Component\HttpFoundation\Request $request:

Return value

\Symfony\Component\HttpFoundation\JsonResponse

1 string reference to 'ToolbarController::savePerformanceTimingAction'
webprofiler.routing.yml in webprofiler/webprofiler.routing.yml
webprofiler/webprofiler.routing.yml

File

webprofiler/src/Controller/ToolbarController.php, line 98

Class

ToolbarController
Class ToolbarController

Namespace

Drupal\webprofiler\Controller

Code

public function savePerformanceTimingAction(Profile $profile, Request $request) {
  $this->profiler
    ->disable();
  $data = Json::decode($request
    ->getContent());

  /** @var  $collector */
  $collector = $profile
    ->getCollector('performance_timing');
  $collector
    ->setData($data);
  $this->profiler
    ->updateProfile($profile);
  return new JsonResponse([
    'success' => TRUE,
  ]);
}