Ignore:
Timestamp:
Apr 4, 2006, 5:11:08 AM (19 years ago)
Author:
eseidel
Message:

2006-04-04 Bjrn Graf <[email protected]>

Reviewed by ggaren & darin. Landed by eseidel.

Integrate CURL version of gettimeofday
http://bugzilla.opendarwin.org/show_bug.cgi?id=7399
Disable crash report dialogs for testkjs.exe in Release mode
http://bugzilla.opendarwin.org/show_bug.cgi?id=8113

  • kjs/testkjs.cpp: (StopWatch::start): (StopWatch::stop): (StopWatch::getElapsedMS): (main): (kjsmain):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/testkjs.cpp

    r13211 r13680  
    33 *  This file is part of the KDE libraries
    44 *  Copyright (C) 1999-2000 Harri Porten ([email protected])
    5  *  Copyright (C) 2004 Apple Computer, Inc.
     5 *  Copyright (C) 2004-2006 Apple Computer, Inc.
     6 *  Copyright (C) 2006 Björn Graf ([email protected])
    67 *
    78 *  This library is free software; you can redistribute it and/or
     
    3940#endif
    4041
     42#if PLATFORM(WIN_OS)
     43#include <windows.h>
     44#endif
     45
    4146using namespace KJS;
    4247using namespace KXMLCore;
     
    5358   
    5459private:
    55 #if !PLATFORM(WIN_OS)
     60#if PLATFORM(WIN_OS)
     61    DWORD m_startTime;
     62    DWORD m_stopTime;
     63#else
    5664    // Windows does not have timeval, disabling this class for now (bug 7399)
    5765    timeval m_startTime;
     
    6270void StopWatch::start()
    6371{
    64 #if !PLATFORM(WIN_OS)
     72#if PLATFORM(WIN_OS)
     73    m_startTime = timeGetTime();
     74#else
    6575    gettimeofday(&m_startTime, 0);
    6676#endif
     
    6979void StopWatch::stop()
    7080{
    71 #if !PLATFORM(WIN_OS)
     81#if PLATFORM(WIN_OS)
     82    m_stopTime = timeGetTime();
     83#else
    7284    gettimeofday(&m_stopTime, 0);
    7385#endif
     
    7688long StopWatch::getElapsedMS()
    7789{
    78 #if !PLATFORM(WIN_OS)
     90#if PLATFORM(WIN_OS)
     91    return m_stopTime - m_startTime;
     92#else
    7993    timeval elapsedTime;
    8094    timersub(&m_stopTime, &m_startTime, &elapsedTime);
    8195   
    8296    return elapsedTime.tv_sec * 1000 + lroundf(elapsedTime.tv_usec / 1000.0);
    83 #else
    84     return 0;
    8597#endif
    8698}
     
    152164}
    153165
     166#if PLATFORM(WIN_OS)
     167
     168// Use SEH for Release builds only to get rid of the crash report dialog
     169// (luckyly the same tests fail in Release and Debug builds so far). Need to
     170// be in a separate main function because the kjsmain function requires object
     171// unwinding.
     172
     173#if defined(_DEBUG)
     174#define TRY
     175#define EXCEPT(x)
     176#else
     177#define TRY       __try {
     178#define EXCEPT(x) } __except (EXCEPTION_EXECUTE_HANDLER) { x; }
     179#endif
     180
     181#else
     182
     183#define TRY
     184#define EXCEPT(x)
     185
     186#endif
     187
     188int kjsmain(int argc, char** argv);
     189
    154190int main(int argc, char** argv)
     191{
     192    int res = 0;
     193    TRY
     194        res = kjsmain(argc, argv);
     195    EXCEPT(res = 3)
     196    return res;
     197}
     198
     199int kjsmain(int argc, char** argv)
    155200{
    156201  if (argc < 2) {
Note: See TracChangeset for help on using the changeset viewer.