Changeset 87707 in webkit


Ignore:
Timestamp:
May 30, 2011 7:21:49 PM (13 years ago)
Author:
noam.rosenthal@nokia.com
Message:

2011-05-30 No'am Rosenthal <noam.rosenthal@nokia.com>

Reviewed by Simon Hausmann.

WebKit2: Enable serializing of data types needed for cross-process accelerated compositing
https://bugs.webkit.org/show_bug.cgi?id=61694

Expose a public clearAll() function to reset WebCore::Animation.

No new functionality, so no new tests.

  • platform/animation/Animation.h: (WebCore::Animation::clearAll):

2011-05-30 No'am Rosenthal <noam.rosenthal@nokia.com>

Reviewed by Simon Hausmann.

WebKit2: Enable serializing of data types needed for cross-process accelerated compositing
https://bugs.webkit.org/show_bug.cgi?id=61694

Create an ArgumentCoder for WebCore::Animation.

  • Scripts/webkit2/messages.py:
  • Shared/WebCoreArgumentCoders.h:
Location:
trunk/Source
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r87704 r87707  
     12011-05-30  No'am Rosenthal  <noam.rosenthal@nokia.com>
     2
     3        Reviewed by Simon Hausmann.
     4
     5        WebKit2: Enable serializing of data types needed for cross-process accelerated compositing
     6        https://bugs.webkit.org/show_bug.cgi?id=61694
     7
     8        Expose a public clearAll() function to reset WebCore::Animation.
     9
     10        No new functionality, so no new tests.
     11
     12        * platform/animation/Animation.h:
     13        (WebCore::Animation::clearAll):
     14
    1152011-05-30  Eric Carlson  <eric.carlson@apple.com>
    216
  • trunk/Source/WebCore/platform/animation/Animation.h

    r71125 r87707  
    8282    void clearTimingFunction() { m_timingFunctionSet = false; }
    8383
     84    void clearAll()
     85    {
     86        clearDelay();
     87        clearDirection();
     88        clearDuration();
     89        clearFillMode();
     90        clearIterationCount();
     91        clearName();
     92        clearPlayState();
     93        clearProperty();
     94        clearTimingFunction();
     95    }
     96
    8497    double delay() const { return m_delay; }
    8598
  • trunk/Source/WebKit2/ChangeLog

    r87701 r87707  
     12011-05-30  No'am Rosenthal  <noam.rosenthal@nokia.com>
     2
     3        Reviewed by Simon Hausmann.
     4
     5        WebKit2: Enable serializing of data types needed for cross-process accelerated compositing
     6        https://bugs.webkit.org/show_bug.cgi?id=61694
     7
     8        Create an ArgumentCoder for WebCore::Animation.
     9
     10        * Scripts/webkit2/messages.py:
     11        * Shared/WebCoreArgumentCoders.h:
     12
    1132011-05-30  No'am Rosenthal  <noam.rosenthal@nokia.com>
    214
  • trunk/Source/WebKit2/Scripts/webkit2/messages.py

    r87701 r87707  
    252252def struct_or_class(namespace, type):
    253253    structs = frozenset([
     254        'WebCore::Animation',
    254255        'WebCore::EditorCommandsForKeyEvent',
    255256        'WebCore::CompositionUnderline',
  • trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h

    r87701 r87707  
    3232#include "Arguments.h"
    3333#include "ShareableBitmap.h"
     34#include <WebCore/Animation.h>
    3435#include <WebCore/AuthenticationChallenge.h>
    3536#include <WebCore/BitmapImage.h>
     
    560561};
    561562
     563template<> struct ArgumentCoder<WebCore::Animation> {
     564    static bool encodeBoolAndReturnValue(ArgumentEncoder* encoder, bool value)
     565    {
     566        encoder->encodeBool(value);
     567        return value;
     568    }
     569
     570    template<typename T>
     571    static void encodeBoolAndValue(ArgumentEncoder* encoder, bool isSet, const T& value)
     572    {
     573        if (encodeBoolAndReturnValue(encoder, isSet))
     574            encoder->encode<T>(value);
     575    }
     576
     577    static bool decodeBoolAndValue(ArgumentDecoder* decoder, bool& isSet, double& value)
     578    {
     579        if (!decoder->decodeBool(isSet))
     580            return false;
     581        if (!isSet)
     582            return true;
     583
     584        return decoder->decodeDouble(value);
     585    }
     586
     587    template<class T>
     588    static bool decodeBoolAndValue(ArgumentDecoder* decoder, bool& isSet, T& value)
     589    {
     590        if (!decoder->decodeBool(isSet))
     591            return false;
     592        if (!isSet)
     593            return true;
     594
     595        return ArgumentCoder<T>::decode(decoder, value);
     596    }
     597
     598    static bool decodeBoolAndValue(ArgumentDecoder* decoder, bool& isSet, int& value)
     599    {
     600        if (!decoder->decodeBool(isSet))
     601            return false;
     602        if (!isSet)
     603            return true;
     604
     605        return decoder->decodeInt32(value);
     606    }
     607
     608    static void encode(ArgumentEncoder* encoder, const WebCore::Animation& animation)
     609    {
     610        encodeBoolAndValue(encoder, animation.isDelaySet(), animation.delay());
     611        encodeBoolAndValue<int>(encoder, animation.isDirectionSet(), animation.direction());
     612        encodeBoolAndValue(encoder, animation.isDurationSet(), animation.duration());
     613        encodeBoolAndValue(encoder, animation.isFillModeSet(), animation.fillMode());
     614        encodeBoolAndValue(encoder, animation.isIterationCountSet(), animation.iterationCount());
     615
     616        if (encodeBoolAndReturnValue(encoder, animation.isNameSet()))
     617            ArgumentCoder<String>::encode(encoder, animation.name());
     618
     619        encodeBoolAndValue<int>(encoder, animation.isPlayStateSet(), animation.playState());
     620        encodeBoolAndValue(encoder, animation.isPropertySet(), animation.property());
     621
     622        if (encodeBoolAndReturnValue(encoder, animation.isTimingFunctionSet()))
     623            ArgumentCoder<RefPtr<WebCore::TimingFunction> >::encode(encoder, animation.timingFunction());
     624        encoder->encodeBool(animation.isNoneAnimation());
     625    }
     626
     627    static bool decode(ArgumentDecoder* decoder, WebCore::Animation& animation)
     628    {
     629        bool isDelaySet, isDirectionSet, isDurationSet, isFillModeSet, isIterationCountSet, isNameSet, isPlayStateSet, isPropertySet, isTimingFunctionSet;
     630        int property, iterationCount, direction, fillMode, playState;
     631        double delay, duration;
     632        RefPtr<WebCore::TimingFunction> timingFunction;
     633        String name;
     634
     635        animation.clearAll();
     636
     637        if (!decodeBoolAndValue(decoder, isDelaySet, delay))
     638            return false;
     639        if (!decodeBoolAndValue(decoder, isDirectionSet, direction))
     640            return false;
     641        if (!decodeBoolAndValue(decoder, isDurationSet, duration))
     642            return false;
     643        if (!decodeBoolAndValue(decoder, isFillModeSet, fillMode))
     644            return false;
     645        if (!decodeBoolAndValue(decoder, isIterationCountSet, iterationCount))
     646            return false;
     647        if (!decodeBoolAndValue<String>(decoder, isNameSet, name))
     648            return false;
     649        if (!decodeBoolAndValue(decoder, isPlayStateSet, playState))
     650            return false;
     651        if (!decodeBoolAndValue(decoder, isPropertySet, property))
     652            return false;
     653        if (!decodeBoolAndValue<RefPtr<WebCore::TimingFunction> >(decoder, isTimingFunctionSet, timingFunction))
     654            return false;
     655
     656        if (isDelaySet)
     657            animation.setDelay(delay);
     658        if (isDirectionSet)
     659            animation.setDirection(static_cast<WebCore::Animation::AnimationDirection>(direction));
     660        if (isDurationSet)
     661            animation.setDuration(duration);
     662        if (isFillModeSet)
     663            animation.setFillMode(fillMode);
     664        if (isIterationCountSet)
     665            animation.setIterationCount(iterationCount);
     666        if (isNameSet)
     667            animation.setName(name);
     668        if (isPlayStateSet)
     669            animation.setPlayState(static_cast<WebCore::EAnimPlayState>(playState));
     670        if (isPropertySet)
     671            animation.setProperty(property);
     672        if (isTimingFunctionSet)
     673            animation.setTimingFunction(timingFunction);
     674
     675        return true;
     676    }
     677};
     678
    562679} // namespace CoreIPC
    563680
Note: See TracChangeset for help on using the changeset viewer.