agent/browser/ie/pagetest/PagetestReporting.cpp
/*-----------------------------------------------------------------------------
	Sort the events by start time since some events actually start well after
	they were inserted into the list
-----------------------------------------------------------------------------*/
Sort the events by start time since some events actually start well after
they were inserted into the list
Sort the events by start time since some events actually start well after they were inserted into the list
void CPagetestReporting::SortEvents()
{
	CAtlList<CTrackedEvent *>	tmp;
	POSITION pos = events.GetHeadPosition();
	while( pos )
	{
		CTrackedEvent * e = events.GetNext(pos);
		if( e )
		{
			CWinInetRequest * w = (CWinInetRequest *)e;
			if( e->type == CTrackedEvent::etWinInetRequest && !w->start && w->created )
				w->start = w->created;
			if( e->start )
				tmp.AddTail(e);
		}
	}
	events.RemoveAll();
	pos = tmp.GetHeadPosition();
	while( pos )
	{
		CTrackedEvent * e = tmp.GetNext(pos);
		if( e )
		{
			if( events.IsEmpty() )
				events.AddTail(e);
			else
			{
				bool inserted = false;
				POSITION next = events.GetHeadPosition();
				while( !inserted && next )
				{
					POSITION p = next;
					CTrackedEvent * n = events.GetNext(next);
					if( n )
					{
						if( e->start < n->start )
						{
							events.InsertBefore(p, e);
							inserted = true;
						}
					}
				}
				if( !inserted )
					events.AddTail(e);
			}
		}
	}
}
void CPagetestReporting :: SortEvents ( ) { CAtlList < CTrackedEvent * > tmp ; POSITION pos = events . GetHeadPosition ( ) ; while ( pos ) { CTrackedEvent * e = events . GetNext ( pos ) ; if ( e ) { CWinInetRequest * w = ( CWinInetRequest * ) e ; if ( e -> type == CTrackedEvent :: etWinInetRequest && ! w -> start && w -> created ) w -> start = w -> created ; if ( e -> start ) tmp . AddTail ( e ) ; } } events . RemoveAll ( ) ; pos = tmp . GetHeadPosition ( ) ; while ( pos ) { CTrackedEvent * e = tmp . GetNext ( pos ) ; if ( e ) { if ( events . IsEmpty ( ) ) events . AddTail ( e ) ; else { bool inserted = false ; POSITION next = events . GetHeadPosition ( ) ; while ( ! inserted && next ) { POSITION p = next ; CTrackedEvent * n = events . GetNext ( next ) ; if ( n ) { if ( e -> start < n -> start ) { events . InsertBefore ( p , e ) ; inserted = true ; } } } if ( ! inserted ) events . AddTail ( e ) ; } } } }
Sort the events by start time since some events actually start well after
they were inserted into the list
Sort the events by start time since some events actually start well after they were inserted into the list
// move all of the events over to a temporary list, making sure the start times are set correctly
 // figure out where to insert it
