• Raphael Kubo da Costa's avatar
    CompositorFrameReportingController: Do not rely on C++20 features in DCHECK_NE call · 684c915a
    Raphael Kubo da Costa authored
    Follow-up to commit a572c15d ("Report the latency increase of pipeline
    stages in missed frames compared to not missed frames"), which ended up
    reverting commit aeed4d1f ("libstdc++: do not assume unique_ptr has ostream
    operator"). A call that looks like
    
        DCHECK_NE(foo, nullptr);
    
    where |foo| is a std::unique_ptr fails with libstdc++ because there is no
    operator<< overload for std::unique_ptr until C++20 (libc++ just happens to
    have it):
    
    ../../cc/scheduler/compositor_frame_reporting_controller.cc:60:3: error: no matching function for call to 'MakeCheckOpValueString'
      DCHECK_NE(reporters_[PipelineStage::kBeginMainFrame],
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../../base/logging.h:851:31: note: expanded from macro 'DCHECK_NE'
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../../base/logging.h:822:29: note: expanded from macro 'DCHECK_OP'
      EAT_STREAM_PARAMETERS << (::logging::MakeCheckOpValueString(      \
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../../base/logging.h:635:18: note: candidate function not viable: no known conversion from 'std::unique_ptr<CompositorFrameReporter>' to 'std::nullptr_t'
          (aka 'nullptr_t') for 2nd argument
    BASE_EXPORT void MakeCheckOpValueString(std::ostream* os, std::nullptr_t p);
                     ^
    ../../base/logging.h:596:1: note: candidate template ignored: requirement 'base::internal::SupportsOstreamOperator<const unique_ptr<CompositorFrameReporter,
          default_delete<CompositorFrameReporter> > &>::value' was not satisfied [with T = std::unique_ptr<cc::CompositorFrameReporter,
          std::default_delete<cc::CompositorFrameReporter> >]
    MakeCheckOpValueString(std::ostream* os, const T& v) {
    ^
    ../../base/logging.h:606:1: note: candidate template ignored: requirement 'base::internal::SupportsToString<const unique_ptr<CompositorFrameReporter,
          default_delete<CompositorFrameReporter> > &>::value' was not satisfied [with T = std::unique_ptr<cc::CompositorFrameReporter,
          std::default_delete<cc::CompositorFrameReporter> >]
    MakeCheckOpValueString(std::ostream* os, const T& v) {
    ^
    ../../base/logging.h:619:1: note: candidate template ignored: requirement 'std::is_function<typename std::remove_pointer<unique_ptr<CompositorFrameReporter,
          default_delete<CompositorFrameReporter> > >::type>::value' was not satisfied [with T = std::unique_ptr<cc::CompositorFrameReporter,
          std::default_delete<cc::CompositorFrameReporter> >]
    MakeCheckOpValueString(std::ostream* os, const T& v) {
    ^
    ../../base/logging.h:630:1: note: candidate template ignored: requirement 'std::is_enum<unique_ptr<CompositorFrameReporter,
          default_delete<CompositorFrameReporter> > >::value' was not satisfied [with T = std::unique_ptr<cc::CompositorFrameReporter,
          std::default_delete<cc::CompositorFrameReporter> >]
    MakeCheckOpValueString(std::ostream* os, const T& v) {
    ^
    
    Bug: 957519
    Change-Id: Icbc23eb23b4641a64dfeb00d27ea1d393dda232a
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1672860
    Commit-Queue: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com>
    Auto-Submit: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com>
    Reviewed-by: default avatarSunny Sachanandani <sunnyps@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#672024}
    684c915a
compositor_frame_reporting_controller.cc 6.78 KB