Replace remaining manual children checks with HasChildren().

This commit is contained in:
Bartosz Taudul 2020-02-21 00:36:45 +01:00
parent ecc9369da2
commit ba0715b295
2 changed files with 6 additions and 6 deletions

View File

@ -3341,7 +3341,7 @@ int View::DrawZoneLevel( const V& vec, bool hover, double pxns, int64_t nspx, co
const auto color = GetZoneColor( ev, tid, depth ); const auto color = GetZoneColor( ev, tid, depth );
const char* zoneName = m_worker.GetZoneName( ev ); const char* zoneName = m_worker.GetZoneName( ev );
if( ev.Child() >= 0 ) if( ev.HasChildren() )
{ {
const auto d = DispatchZoneLevel( m_worker.GetZoneChildren( ev.Child() ), hover, pxns, nspx, wpos, _offset, depth, yMin, yMax, tid ); const auto d = DispatchZoneLevel( m_worker.GetZoneChildren( ev.Child() ), hover, pxns, nspx, wpos, _offset, depth, yMin, yMax, tid );
if( d > maxdepth ) maxdepth = d; if( d > maxdepth ) maxdepth = d;
@ -3493,7 +3493,7 @@ int View::SkipZoneLevel( const V& vec, bool hover, double pxns, int64_t nspx, co
} }
else else
{ {
if( ev.Child() >= 0 ) if( ev.HasChildren() )
{ {
const auto d = DispatchZoneLevel( m_worker.GetZoneChildren( ev.Child() ), hover, pxns, nspx, wpos, _offset, depth, yMin, yMax, tid ); const auto d = DispatchZoneLevel( m_worker.GetZoneChildren( ev.Child() ), hover, pxns, nspx, wpos, _offset, depth, yMin, yMax, tid );
if( d > maxdepth ) maxdepth = d; if( d > maxdepth ) maxdepth = d;
@ -5776,7 +5776,7 @@ void View::CalcZoneTimeDataImpl( const V& children, const ContextSwitch* ctx, un
it->second.time += t; it->second.time += t;
it->second.count++; it->second.count++;
} }
if( a(child).Child() >= 0 ) CalcZoneTimeData( ctx, data, it->second.time, a(child) ); if( a(child).HasChildren() ) CalcZoneTimeData( ctx, data, it->second.time, a(child) );
} }
} }
@ -14314,7 +14314,7 @@ int View::GetZoneDepth( const ZoneEvent& zone, uint64_t tid ) const
if( it != vec->begin() ) --it; if( it != vec->begin() ) --it;
assert( !( zone.IsEndValid() && it->Start() > zone.End() ) ); assert( !( zone.IsEndValid() && it->Start() > zone.End() ) );
if( it == &zone ) return depth; if( it == &zone ) return depth;
assert( it->Child() >= 0 ); assert( it->HasChildren() );
timeline = &m_worker.GetZoneChildren( it->Child() ); timeline = &m_worker.GetZoneChildren( it->Child() );
depth++; depth++;
} }
@ -14324,7 +14324,7 @@ int View::GetZoneDepth( const ZoneEvent& zone, uint64_t tid ) const
if( it != timeline->begin() ) --it; if( it != timeline->begin() ) --it;
assert( !( zone.IsEndValid() && (*it)->Start() > zone.End() ) ); assert( !( zone.IsEndValid() && (*it)->Start() > zone.End() ) );
if( *it == &zone ) return depth; if( *it == &zone ) return depth;
assert( (*it)->Child() >= 0 ); assert( (*it)->HasChildren() );
timeline = &m_worker.GetZoneChildren( (*it)->Child() ); timeline = &m_worker.GetZoneChildren( (*it)->Child() );
depth++; depth++;
} }

View File

@ -5842,7 +5842,7 @@ void Worker::WriteTimelineImpl( FileWrite& f, const V& vec, int64_t& refTime )
int64_t start = v.Start(); int64_t start = v.Start();
WriteTimeOffset( f, refTime, start ); WriteTimeOffset( f, refTime, start );
f.Write( &v.extra, sizeof( v.extra ) ); f.Write( &v.extra, sizeof( v.extra ) );
if( v.Child() < 0 ) if( !v.HasChildren() )
{ {
const uint32_t sz = 0; const uint32_t sz = 0;
f.Write( &sz, sizeof( sz ) ); f.Write( &sz, sizeof( sz ) );