Changeset 87701 in webkit


Ignore:
Timestamp:
May 30, 2011 4:43:58 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

Added a public TimingFunction::type() method.

No new functionality, so no new tests.

  • platform/animation/TimingFunction.h: (WebCore::TimingFunction::type):

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

Add an ArgumentCoder for WebCore::TimingFunction. This serializer can create the appropriate
TimingFunction subclass based on the type of timing function.

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

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r87700 r87701  
     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        Added a public TimingFunction::type() method.
     9
     10        No new functionality, so no new tests.
     11
     12        * platform/animation/TimingFunction.h:
     13        (WebCore::TimingFunction::type):
     14
    1152011-05-30  Noam Rosenthal  <noam.rosenthal@nokia.com>
    216
  • trunk/Source/WebCore/platform/animation/TimingFunction.h

    r80289 r87701  
    3838   
    3939    virtual ~TimingFunction() { }
     40
     41    TimingFunctionType type() const { return m_type; }
    4042   
    4143    bool isLinearTimingFunction() const { return m_type == LinearFunction; }
  • trunk/Source/WebKit2/ChangeLog

    r87699 r87701  
     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        Add an ArgumentCoder for WebCore::TimingFunction. This serializer can create the appropriate
     9        TimingFunction subclass based on the type of timing function.
     10
     11        * Scripts/webkit2/messages.py:
     12        * Shared/WebCoreArgumentCoders.h:
     13
    1142011-05-30  No'am Rosenthal  <noam.rosenthal@nokia.com>
    215
  • trunk/Source/WebKit2/Scripts/webkit2/messages.py

    r87699 r87701  
    259259        'WebCore::PluginInfo',
    260260        'WebCore::PrintInfo',
     261        'WebCore::TimingFunction',
    261262        'WebCore::TransformationMatrix',
    262263        'WebCore::ViewportArguments',
  • trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h

    r87699 r87701  
    4949#include <WebCore/ResourceRequest.h>
    5050#include <WebCore/TextCheckerClient.h>
     51#include <WebCore/TimingFunction.h>
    5152#include <WebCore/TransformationMatrix.h>
    5253#include <WebCore/ViewportArguments.h>
     
    486487};
    487488
     489template<> struct ArgumentCoder<RefPtr<WebCore::TimingFunction> > {
     490    static void encode(ArgumentEncoder* encoder, const RefPtr<WebCore::TimingFunction>& function)
     491    {
     492        // We don't want to encode null-references.
     493        ASSERT(function);
     494
     495        WebCore::TimingFunction::TimingFunctionType type = function->type();
     496        encoder->encodeInt32(type);
     497        switch (type) {
     498        case WebCore::TimingFunction::LinearFunction:
     499            break;
     500        case WebCore::TimingFunction::CubicBezierFunction: {
     501            WebCore::CubicBezierTimingFunction* cubicFunction = static_cast<WebCore::CubicBezierTimingFunction*>(function.get());
     502            encoder->encodeDouble(cubicFunction->x1());
     503            encoder->encodeDouble(cubicFunction->y1());
     504            encoder->encodeDouble(cubicFunction->x2());
     505            encoder->encodeDouble(cubicFunction->y2());
     506            break;
     507        }
     508        case WebCore::TimingFunction::StepsFunction: {
     509            WebCore::StepsTimingFunction* stepsFunction = static_cast<WebCore::StepsTimingFunction*>(function.get());
     510            encoder->encodeInt32(stepsFunction->numberOfSteps());
     511            encoder->encodeBool(stepsFunction->stepAtStart());
     512            break;
     513        }
     514        }
     515    }
     516
     517    static bool decode(ArgumentDecoder* decoder, RefPtr<WebCore::TimingFunction>& function)
     518    {
     519        WebCore::TimingFunction::TimingFunctionType type;
     520        int typeInt;
     521        if (!decoder->decodeInt32(typeInt))
     522            return false;
     523
     524        type = static_cast<WebCore::TimingFunction::TimingFunctionType>(typeInt);
     525        switch (type) {
     526        case WebCore::TimingFunction::LinearFunction:
     527            function = WebCore::LinearTimingFunction::create();
     528            return true;
     529
     530        case WebCore::TimingFunction::CubicBezierFunction: {
     531            double x1, y1, x2, y2;
     532            if (!decoder->decodeDouble(x1))
     533                return false;
     534            if (!decoder->decodeDouble(y1))
     535                return false;
     536            if (!decoder->decodeDouble(x2))
     537                return false;
     538            if (!decoder->decodeDouble(y2))
     539                return false;
     540            function = WebCore::CubicBezierTimingFunction::create(x1, y1, x2, y2);
     541            return true;
     542        }
     543
     544        case WebCore::TimingFunction::StepsFunction: {
     545            int numSteps;
     546            bool stepAtStart;
     547            if (!decoder->decodeInt32(numSteps))
     548                return false;
     549            if (!decoder->decodeBool(stepAtStart))
     550                return false;
     551
     552            function = WebCore::StepsTimingFunction::create(numSteps, stepAtStart);
     553            return true;
     554        }
     555
     556        }
     557
     558        return false;
     559    }
     560};
     561
    488562} // namespace CoreIPC
    489563
Note: See TracChangeset for help on using the changeset viewer.