Blob Blame History Raw
From 56c654a91600e3bf254aa9f66c1151b0850b6ee4 Mon Sep 17 00:00:00 2001
From: Jose Dapena Paz <jdapena@igalia.com>
Date: Wed, 11 Nov 2020 10:24:47 +0100
Subject: [PATCH] GCC: do not pass unique_ptr to DCHECK_NE, but the actual pointer, in CompositorFrameReporter

DCHECK_NE comparison requires CheckOpValueStr to be defined for the
type, or providing an output stream operator. A unique_ptr does not
provide any.

Compilation in GCC is failing in CompositorFrameReporter because of
this:
../../cc/metrics/compositor_frame_reporter.cc: In member function ‘void cc::CompositorFrameReporter::ReportEventLatencyHistograms() const’:
../../base/check_op.h:224:59: error: no matching function for call to ‘CheckOpValueStr(const std::unique_ptr<cc::EventMetrics>&)’

Fixed comparing the result of get() method for unique_ptr instead of
the unique_ptr.

Bug: 819294
Change-Id: I11103d1867c7196c1de92e72f9f12dcfd31c29f1

(updated to use DCHECK as suggested in comments)
---

diff --git a/cc/metrics/compositor_frame_reporter.cc b/cc/metrics/compositor_frame_reporter.cc
index 725beb0..fafd0f3 100644
--- a/cc/metrics/compositor_frame_reporter.cc
+++ b/cc/metrics/compositor_frame_reporter.cc
@@ -686,7 +686,7 @@
 
 void CompositorFrameReporter::ReportEventLatencyHistograms() const {
   for (const auto& event_metrics : events_metrics_) {
-    DCHECK_NE(event_metrics, nullptr);
+    DCHECK(event_metrics);
     const std::string histogram_base_name =
         GetEventLatencyHistogramBaseName(*event_metrics);
     const int event_type_index = static_cast<int>(event_metrics->type());