Changeset 167140 in webkit


Ignore:
Timestamp:
Apr 11, 2014 1:05:39 PM (10 years ago)
Author:
Brian Burg
Message:

Web Replay: CodeGeneratorJS should guard includes of replay-related headers
https://bugs.webkit.org/show_bug.cgi?id=131407

Reviewed by Timothy Hatcher.

This patch adds guards to headers that are only required by generated replay code
that is itself guarded. Other ports probably haven't added the headers to their
build files, so we don't want to emit the unused header includes.

This patch also converts generated uses of DEFINE_STATIC_LOCAL to NeverDestroyed<T>.
Finally, a new bindings test was added to document changes to generated replay code.

Test: Source/WebCore/bindings/scripts/test/TestNondeterministic.idl

  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateImplementation):
(GenerateImplementationFunctionCall):

  • bindings/scripts/test/GObject/WebKitDOMTestNondeterministic.cpp: Added.
  • bindings/scripts/test/GObject/WebKitDOMTestNondeterministic.h: Added.
  • bindings/scripts/test/GObject/WebKitDOMTestNondeterministic.symbols: Added.
  • bindings/scripts/test/GObject/WebKitDOMTestNondeterministicPrivate.h: Added.
  • bindings/scripts/test/JS/JSTestNondeterministic.cpp: Added.
  • bindings/scripts/test/JS/JSTestNondeterministic.h: Added.
  • bindings/scripts/test/ObjC/DOMTestNondeterministic.h: Added.
  • bindings/scripts/test/ObjC/DOMTestNondeterministic.mm: Added.
  • bindings/scripts/test/ObjC/DOMTestNondeterministicInternal.h: Added.
  • bindings/scripts/test/TestNondeterministic.idl: Added.
Location:
trunk/Source/WebCore
Files:
10 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r167138 r167140  
     12014-04-11  Brian J. Burg  <burg@cs.washington.edu>
     2
     3        Web Replay: CodeGeneratorJS should guard includes of replay-related headers
     4        https://bugs.webkit.org/show_bug.cgi?id=131407
     5
     6        Reviewed by Timothy Hatcher.
     7
     8        This patch adds guards to headers that are only required by generated replay code
     9        that is itself guarded. Other ports probably haven't added the headers to their
     10        build files, so we don't want to emit the unused header includes.
     11
     12        This patch also converts generated uses of DEFINE_STATIC_LOCAL to NeverDestroyed<T>.
     13        Finally, a new bindings test was added to document changes to generated replay code.
     14
     15        Test: Source/WebCore/bindings/scripts/test/TestNondeterministic.idl
     16
     17        * bindings/scripts/CodeGeneratorJS.pm:
     18        (GenerateImplementation):
     19        (GenerateImplementationFunctionCall):
     20
     21        * bindings/scripts/test/GObject/WebKitDOMTestNondeterministic.cpp: Added.
     22        * bindings/scripts/test/GObject/WebKitDOMTestNondeterministic.h: Added.
     23        * bindings/scripts/test/GObject/WebKitDOMTestNondeterministic.symbols: Added.
     24        * bindings/scripts/test/GObject/WebKitDOMTestNondeterministicPrivate.h: Added.
     25        * bindings/scripts/test/JS/JSTestNondeterministic.cpp: Added.
     26        * bindings/scripts/test/JS/JSTestNondeterministic.h: Added.
     27        * bindings/scripts/test/ObjC/DOMTestNondeterministic.h: Added.
     28        * bindings/scripts/test/ObjC/DOMTestNondeterministic.mm: Added.
     29        * bindings/scripts/test/ObjC/DOMTestNondeterministicInternal.h: Added.
     30        * bindings/scripts/test/TestNondeterministic.idl: Added.
     31
    1322014-04-11  Antti Koivisto  <antti@apple.com>
    233
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r167020 r167140  
    21972197
    21982198            if ($attribute->signature->extendedAttributes->{"Nondeterministic"}) {
    2199                 $implIncludes{"<replay/InputCursor.h>"} = 1;
     2199                AddToImplIncludes("MemoizedDOMResult.h", "WEB_REPLAY");
     2200                AddToImplIncludes("<replay/InputCursor.h>", "WEB_REPLAY");
     2201                AddToImplIncludes("<wtf/NeverDestroyed.h>", "WEB_REPLAY");
     2202
    22002203                push(@implContent, "#if ENABLE(WEB_REPLAY)\n");
    22012204                push(@implContent, "    JSGlobalObject* globalObject = exec->lexicalGlobalObject();\n");
    22022205                push(@implContent, "    InputCursor& cursor = globalObject->inputCursor();\n");
    22032206
    2204                 $implIncludes{"MemoizedDOMResult.h"} = 1;
    22052207                my $nativeType = GetNativeType($type);
    22062208                my $memoizedType = GetNativeTypeForMemoization($type);
    22072209                my $exceptionCode = $getterExceptions ? "ec" : "0";
    2208                 push(@implContent, "    DEPRECATED_DEFINE_STATIC_LOCAL(const AtomicString, bindingName, (\"$interfaceName.$name\", AtomicString::ConstructFromLiteral));\n");
     2210                push(@implContent, "    static NeverDestroyed<const AtomicString> bindingName(\"$interfaceName.$name\", AtomicString::ConstructFromLiteral);\n");
    22092211                push(@implContent, "    if (cursor.isCapturing()) {\n");
    22102212                push(@implContent, "        $memoizedType memoizedResult = castedThis->impl().$implGetterFunctionName(" . join(", ", @arguments) . ");\n");
    2211                 push(@implContent, "        cursor.appendInput<MemoizedDOMResult<$memoizedType>>(bindingName, memoizedResult, $exceptionCode);\n");
     2213                push(@implContent, "        cursor.appendInput<MemoizedDOMResult<$memoizedType>>(bindingName.get().string(), memoizedResult, $exceptionCode);\n");
    22122214                push(@implContent, "        JSValue result = " . NativeToJSValue($attribute->signature, 0, $interfaceName, "memoizedResult", "castedThis") . ";\n");
    22132215                push(@implContent, "        setDOMException(exec, ec);\n") if $getterExceptions;
     
    35563558    if ($function->signature->type eq "void") {
    35573559        if ($nondeterministic) {
    3558             $implIncludes{"<replay/InputCursor.h>"} = 1;
     3560            AddToImplIncludes("<replay/InputCursor.h>", "WEB_REPLAY");
    35593561            push(@implContent, "#if ENABLE(WEB_REPLAY)\n");
    35603562            push(@implContent, $indent . "InputCursor& cursor = exec->lexicalGlobalObject()->inputCursor();\n");
     
    35853587        my $thisObject = $function->isStatic ? 0 : "castedThis";
    35863588        if ($nondeterministic) {
    3587             $implIncludes{"MemoizedDOMResult.h"} = 1;
    3588             $implIncludes{"<replay/InputCursor.h>"} = 1;
     3589            AddToImplIncludes("MemoizedDOMResult.h", "WEB_REPLAY");
     3590            AddToImplIncludes("<replay/InputCursor.h>", "WEB_REPLAY");
     3591            AddToImplIncludes("<wtf/NeverDestroyed.h>", "WEB_REPLAY");
     3592
    35893593            my $nativeType = GetNativeTypeFromSignature($function->signature);
    35903594            my $memoizedType = GetNativeTypeForMemoization($function->signature->type);
     
    35933597            push(@implContent, "#if ENABLE(WEB_REPLAY)\n");
    35943598            push(@implContent, $indent . "InputCursor& cursor = exec->lexicalGlobalObject()->inputCursor();\n");
    3595             push(@implContent, $indent . "DEFINE_STATIC_LOCAL(const AtomicString, bindingName, (\"$bindingName\", AtomicString::ConstructFromLiteral));\n");
     3599            push(@implContent, $indent . "static NeverDestroyed<const AtomicString> bindingName(\"$bindingName\", AtomicString::ConstructFromLiteral);\n");
    35963600            push(@implContent, $indent . "if (cursor.isCapturing()) {\n");
    35973601            push(@implContent, $indent . "    $nativeType memoizedResult = $functionString;\n");
    35983602            my $exceptionCode = $raisesException ? "ec" : "0";
    3599             push(@implContent, $indent . "    cursor.appendInput<MemoizedDOMResult<$memoizedType>>(bindingName, memoizedResult, $exceptionCode);\n");
     3603            push(@implContent, $indent . "    cursor.appendInput<MemoizedDOMResult<$memoizedType>>(bindingName.get().string(), memoizedResult, $exceptionCode);\n");
    36003604            push(@implContent, $indent . "    result = " . NativeToJSValue($function->signature, 1, $interfaceName, "memoizedResult", $thisObject) . ";\n");
    36013605            push(@implContent, $indent . "} else if (cursor.isReplaying()) {\n");
Note: See TracChangeset for help on using the changeset viewer.