Changeset 100789 in webkit


Ignore:
Timestamp:
Nov 18, 2011 10:36:17 AM (12 years ago)
Author:
igor.oliveira@openbossa.org
Message:

No'am Rosenthal <noam.rosenthal@nokia.com>

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 KeyframeValueList, and modify the TimingFunction ArgumentCoder to
allow encoding const TimingFunctions and not just RefPtr<TimingFunction>.

Reviewed by Simon Hausmann.

  • Scripts/webkit2/messages.py:
  • Shared/WebCoreArgumentCoders.cpp:

(CoreIPC::::encode):
(CoreIPC::::decode):

  • Shared/WebCoreArgumentCoders.h:
Location:
trunk/Source/WebKit2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r100779 r100789  
     12011-11-18 No'am Rosenthal  <noam.rosenthal@nokia.com>
     2
     3        WebKit2: Enable serializing of data types needed for cross-process accelerated compositing
     4        https://bugs.webkit.org/show_bug.cgi?id=61694
     5
     6        Add an ArgumentCoder for KeyframeValueList, and modify the TimingFunction ArgumentCoder to
     7        allow encoding const TimingFunctions and not just RefPtr<TimingFunction>.
     8
     9        Reviewed by Simon Hausmann.
     10
     11        * Scripts/webkit2/messages.py:
     12        * Shared/WebCoreArgumentCoders.cpp:
     13        (CoreIPC::::encode):
     14        (CoreIPC::::decode):
     15        * Shared/WebCoreArgumentCoders.h:
     16
    1172011-11-18  Kenneth Rohde Christiansen  <kenneth@webkit.org>
    218
  • trunk/Source/WebKit2/Scripts/webkit2/messages.py

    r99108 r100789  
    377377        'WebCore::CompositionUnderline': ['<WebCore/Editor.h>'],
    378378        'WebCore::GrammarDetail': ['<WebCore/TextCheckerClient.h>'],
     379        'WebCore::KeyframeValueList': ['<WebCore/GraphicsLayer.h>'],
    379380        'WebCore::KeypressCommand': ['<WebCore/KeyboardEvent.h>'],
    380381        'WebCore::FileChooserSettings': ['<WebCore/FileChooser.h>'],
  • trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp

    r100680 r100789  
    3636#include <WebCore/FileChooser.h>
    3737#include <WebCore/GraphicsContext.h>
     38#include <WebCore/GraphicsLayer.h>
    3839#include <WebCore/Image.h>
    3940#include <WebCore/PluginData.h>
     
    824825void ArgumentCoder<RefPtr<TimingFunction> >::encode(ArgumentEncoder* encoder, const RefPtr<TimingFunction>& function)
    825826{
    826     // We don't want to encode null-references.
    827     ASSERT(function);
     827    encode(encoder, function.get());
     828}
     829
     830void ArgumentCoder<RefPtr<TimingFunction> >::encode(ArgumentEncoder* encoder, const WebCore::TimingFunction* function)
     831{
     832    if (!function) {
     833        encoder->encodeInt32(WebCore::TimingFunction::LinearFunction);
     834        return;
     835    }
    828836
    829837    encoder->encodeEnum(function->type());
     
    832840        break;
    833841    case TimingFunction::CubicBezierFunction: {
    834         CubicBezierTimingFunction* cubicFunction = static_cast<CubicBezierTimingFunction*>(function.get());
     842        const WebCore::CubicBezierTimingFunction* cubicFunction = static_cast<const WebCore::CubicBezierTimingFunction*>(function);
    835843        encoder->encodeDouble(cubicFunction->x1());
    836844        encoder->encodeDouble(cubicFunction->y1());
     
    840848    }
    841849    case TimingFunction::StepsFunction: {
    842         StepsTimingFunction* stepsFunction = static_cast<StepsTimingFunction*>(function.get());
     850        const WebCore::StepsTimingFunction* stepsFunction = static_cast<const WebCore::StepsTimingFunction*>(function);
    843851        encoder->encodeInt32(stepsFunction->numberOfSteps());
    844852        encoder->encodeBool(stepsFunction->stepAtStart());
     
    11471155    return true;
    11481156}
     1157
     1158#if USE(ACCELERATED_COMPOSITING)
     1159
     1160void ArgumentCoder<KeyframeValueList>::encode(ArgumentEncoder* encoder, const WebCore::KeyframeValueList& keyframes)
     1161{
     1162    encoder->encodeUInt32(keyframes.size());
     1163    encoder->encodeInt32(keyframes.property());
     1164    for (size_t i = 0; i < keyframes.size(); ++i) {
     1165        const WebCore::AnimationValue* value = keyframes.at(i);
     1166        encoder->encodeFloat(value->keyTime());
     1167        ArgumentCoder<RefPtr<WebCore::TimingFunction> >::encode(encoder, value->timingFunction());
     1168        switch (keyframes.property()) {
     1169        case WebCore::AnimatedPropertyOpacity: {
     1170            const WebCore::FloatAnimationValue* floatValue = static_cast<const WebCore::FloatAnimationValue*>(value);
     1171            encoder->encodeFloat(floatValue->value());
     1172            break;
     1173        }
     1174        case WebCore::AnimatedPropertyWebkitTransform: {
     1175            const WebCore::TransformAnimationValue* transformValue = static_cast<const WebCore::TransformAnimationValue*>(value);
     1176            ArgumentCoder<WebCore::TransformOperations>::encode(encoder, *transformValue->value());
     1177            break;
     1178        }
     1179        default:
     1180            break;
     1181        }
     1182    }
     1183}
     1184
     1185bool ArgumentCoder<KeyframeValueList>::decode(ArgumentDecoder* decoder, WebCore::KeyframeValueList& keyframes)
     1186{
     1187    uint32_t size;
     1188    int32_t property;
     1189    if (!decoder->decodeUInt32(size))
     1190        return false;
     1191    if (!decoder->decodeInt32(property))
     1192        return false;
     1193
     1194    keyframes = WebCore::KeyframeValueList(WebCore::AnimatedPropertyID(property));
     1195
     1196    for (size_t i = 0; i < size; ++i) {
     1197        float keyTime;
     1198        RefPtr<WebCore::TimingFunction> timingFunction;
     1199        if (!decoder->decodeFloat(keyTime))
     1200            return false;
     1201        if (!ArgumentCoder<RefPtr<WebCore::TimingFunction> >::decode(decoder, timingFunction))
     1202            return false;
     1203
     1204        switch (property) {
     1205        case WebCore::AnimatedPropertyOpacity: {
     1206            float value;
     1207            if (!decoder->decodeFloat(value))
     1208                return false;
     1209            keyframes.insert(new WebCore::FloatAnimationValue(keyTime, value, timingFunction));
     1210            break;
     1211        }
     1212        case WebCore::AnimatedPropertyWebkitTransform: {
     1213            WebCore::TransformOperations value;
     1214            if (!ArgumentCoder<WebCore::TransformOperations>::decode(decoder, value))
     1215                return false;
     1216            keyframes.insert(new WebCore::TransformAnimationValue(keyTime, &value, timingFunction));
     1217            break;
     1218        }
     1219        default:
     1220            break;
     1221        }
     1222    }
     1223
     1224    return true;
     1225}
     1226
    11491227#endif
    11501228
     1229#endif
     1230
    11511231} // namespace CoreIPC
  • trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h

    r100680 r100789  
    4343    class IntRect;
    4444    class IntSize;
     45    class KeyframeValueList;
    4546    class ProtectionSpace;
    4647    class ResourceError;
     
    274275template<> struct ArgumentCoder<RefPtr<WebCore::TimingFunction> > {
    275276    static void encode(ArgumentEncoder*, const RefPtr<WebCore::TimingFunction>&);
     277    static void encode(ArgumentEncoder*, const WebCore::TimingFunction*);
    276278    static bool decode(ArgumentDecoder*, RefPtr<WebCore::TimingFunction>&);
    277279};
     
    293295#endif
    294296
     297#if USE(ACCELERATED_COMPOSITING)
     298template<> struct ArgumentCoder<WebCore::KeyframeValueList> {
     299    static void encode(ArgumentEncoder*, const WebCore::KeyframeValueList& keyframes);
     300    static bool decode(ArgumentDecoder*, WebCore::KeyframeValueList& keyframes);
     301};
     302#endif
     303
    295304} // namespace CoreIPC
    296305
Note: See TracChangeset for help on using the changeset viewer.