Changeset 181914 in webkit


Ignore:
Timestamp:
Mar 24, 2015 3:56:03 PM (9 years ago)
Author:
mark.lam@apple.com
Message:

The ExecutionTimeLimit test should use its own JSGlobalContextRef.
<https://webkit.org/b/143024>

Reviewed by Geoffrey Garen.

Currently, the ExecutionTimeLimit test is using a JSGlobalContextRef
passed in from testapi.c. It should create its own for better
encapsulation of the test.

  • API/tests/ExecutionTimeLimitTest.cpp:

(currentCPUTimeAsJSFunctionCallback):
(testExecutionTimeLimit):

  • API/tests/ExecutionTimeLimitTest.h:
  • API/tests/testapi.c:

(main):

Location:
trunk/Source/JavaScriptCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/API/tests/ExecutionTimeLimitTest.cpp

    r181670 r181914  
    2929#if OS(DARWIN)
    3030
     31#include "JSContextRefPrivate.h"
    3132#include "JavaScriptCore.h"
    3233
     
    3637#include <sys/time.h>
    3738
    38 static JSGlobalContextRef* currentContextForAssertion = nullptr;
     39static JSGlobalContextRef context = nullptr;
    3940
    4041static double currentCPUTime()
     
    6263    UNUSED_PARAM(exception);
    6364   
    64     ASSERT(JSContextGetGlobalContext(ctx) == *currentContextForAssertion);
     65    ASSERT(JSContextGetGlobalContext(ctx) == context);
    6566    return JSValueMakeNumber(ctx, currentCPUTime());
    6667}
     
    9899
    99100
    100 int testExecutionTimeLimit(JSGlobalContextRef* globalContext)
    101 {
    102     JSGlobalContextRef& context = *globalContext;
    103     currentContextForAssertion = globalContext;
     101int testExecutionTimeLimit()
     102{
     103    context = JSGlobalContextCreateInGroup(nullptr, nullptr);
    104104
    105105    JSContextGroupRef contextGroup = JSContextGetGroup(context);
     
    262262    }
    263263
     264    JSGlobalContextRelease(context);
    264265    return failed;
    265266}
  • trunk/Source/JavaScriptCore/API/tests/ExecutionTimeLimitTest.h

    r181670 r181914  
    2727#define ExecutionTimeLimitTest_h
    2828
    29 #include "JSContextRefPrivate.h"
    30 
    3129#ifdef __cplusplus
    3230extern "C" {
     
    3432
    3533/* Returns 1 if failures were encountered.  Else, returns 0. */
    36 int testExecutionTimeLimit(JSGlobalContextRef*);
    37    
     34int testExecutionTimeLimit();
     35
    3836#ifdef __cplusplus
    3937} /* extern "C" */
  • trunk/Source/JavaScriptCore/API/tests/testapi.c

    r181810 r181914  
    18581858
    18591859#if OS(DARWIN)
    1860     failed = testExecutionTimeLimit(&context) || failed;
     1860    failed = testExecutionTimeLimit() || failed;
    18611861#endif /* OS(DARWIN) */
    18621862    failed = testGlobalContextWithFinalizer() || failed;
  • trunk/Source/JavaScriptCore/ChangeLog

    r181901 r181914  
     12015-03-24  Mark Lam  <mark.lam@apple.com>
     2
     3        The ExecutionTimeLimit test should use its own JSGlobalContextRef.
     4        <https://webkit.org/b/143024>
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Currently, the ExecutionTimeLimit test is using a JSGlobalContextRef
     9        passed in from testapi.c.  It should create its own for better
     10        encapsulation of the test.
     11
     12        * API/tests/ExecutionTimeLimitTest.cpp:
     13        (currentCPUTimeAsJSFunctionCallback):
     14        (testExecutionTimeLimit):
     15        * API/tests/ExecutionTimeLimitTest.h:
     16        * API/tests/testapi.c:
     17        (main):
     18
    1192015-03-24  Joseph Pecoraro  <pecoraro@apple.com>
    220
Note: See TracChangeset for help on using the changeset viewer.