| 1 | /* |
| 2 | * Copyright (C) 2010-2018 Apple Inc. All rights reserved. |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions |
| 6 | * are met: |
| 7 | * 1. Redistributions of source code must retain the above copyright |
| 8 | * notice, this list of conditions and the following disclaimer. |
| 9 | * 2. Redistributions in binary form must reproduce the above copyright |
| 10 | * notice, this list of conditions and the following disclaimer in the |
| 11 | * documentation and/or other materials provided with the distribution. |
| 12 | * |
| 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND |
| 14 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 15 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 16 | * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR |
| 17 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 18 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 19 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 20 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 22 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 23 | */ |
| 24 | |
| 25 | #include "config.h" |
| 26 | |
| 27 | #include "DrawingArea.h" |
| 28 | |
| 29 | #if PLATFORM(COCOA) |
| 30 | #include "ArgumentCoders.h" |
| 31 | #endif |
| 32 | #if PLATFORM(COCOA) |
| 33 | #include "CallbackID.h" |
| 34 | #endif |
| 35 | #if PLATFORM(COCOA) |
| 36 | #include "ColorSpaceData.h" |
| 37 | #endif |
| 38 | #include "Decoder.h" |
| 39 | #include "DrawingAreaMessages.h" |
| 40 | #include "HandleMessage.h" |
| 41 | #include "WebCoreArgumentCoders.h" |
| 42 | #if PLATFORM(COCOA) |
| 43 | #include <WebCore/FloatPoint.h> |
| 44 | #endif |
| 45 | #if PLATFORM(COCOA) |
| 46 | #include <WebCore/FloatRect.h> |
| 47 | #endif |
| 48 | #include <WebCore/IntSize.h> |
| 49 | #if PLATFORM(COCOA) |
| 50 | #include <wtf/MachSendRight.h> |
| 51 | #endif |
| 52 | #if PLATFORM(COCOA) |
| 53 | #include <wtf/MonotonicTime.h> |
| 54 | #endif |
| 55 | #if PLATFORM(COCOA) |
| 56 | #include <wtf/Optional.h> |
| 57 | #endif |
| 58 | #if PLATFORM(COCOA) |
| 59 | #include <wtf/text/WTFString.h> |
| 60 | #endif |
| 61 | |
| 62 | namespace WebKit { |
| 63 | |
| 64 | void DrawingArea::didReceiveMessage(IPC::Connection& connection, IPC::Decoder& decoder) |
| 65 | { |
| 66 | if (decoder.messageName() == Messages::DrawingArea::UpdateBackingStoreState::name()) { |
| 67 | IPC::handleMessage<Messages::DrawingArea::UpdateBackingStoreState>(decoder, this, &DrawingArea::updateBackingStoreState); |
| 68 | return; |
| 69 | } |
| 70 | if (decoder.messageName() == Messages::DrawingArea::DidUpdate::name()) { |
| 71 | IPC::handleMessage<Messages::DrawingArea::DidUpdate>(decoder, this, &DrawingArea::didUpdate); |
| 72 | return; |
| 73 | } |
| 74 | #if PLATFORM(COCOA) |
| 75 | if (decoder.messageName() == Messages::DrawingArea::UpdateGeometry::name()) { |
| 76 | IPC::handleMessage<Messages::DrawingArea::UpdateGeometry>(decoder, this, &DrawingArea::updateGeometry); |
| 77 | return; |
| 78 | } |
| 79 | #endif |
| 80 | #if PLATFORM(COCOA) |
| 81 | if (decoder.messageName() == Messages::DrawingArea::SetDeviceScaleFactor::name()) { |
| 82 | IPC::handleMessage<Messages::DrawingArea::SetDeviceScaleFactor>(decoder, this, &DrawingArea::setDeviceScaleFactor); |
| 83 | return; |
| 84 | } |
| 85 | #endif |
| 86 | #if PLATFORM(COCOA) |
| 87 | if (decoder.messageName() == Messages::DrawingArea::SetColorSpace::name()) { |
| 88 | IPC::handleMessage<Messages::DrawingArea::SetColorSpace>(decoder, this, &DrawingArea::setColorSpace); |
| 89 | return; |
| 90 | } |
| 91 | #endif |
| 92 | #if PLATFORM(COCOA) |
| 93 | if (decoder.messageName() == Messages::DrawingArea::SetViewExposedRect::name()) { |
| 94 | IPC::handleMessage<Messages::DrawingArea::SetViewExposedRect>(decoder, this, &DrawingArea::setViewExposedRect); |
| 95 | return; |
| 96 | } |
| 97 | #endif |
| 98 | #if PLATFORM(COCOA) |
| 99 | if (decoder.messageName() == Messages::DrawingArea::AdjustTransientZoom::name()) { |
| 100 | IPC::handleMessage<Messages::DrawingArea::AdjustTransientZoom>(decoder, this, &DrawingArea::adjustTransientZoom); |
| 101 | return; |
| 102 | } |
| 103 | #endif |
| 104 | #if PLATFORM(COCOA) |
| 105 | if (decoder.messageName() == Messages::DrawingArea::CommitTransientZoom::name()) { |
| 106 | IPC::handleMessage<Messages::DrawingArea::CommitTransientZoom>(decoder, this, &DrawingArea::commitTransientZoom); |
| 107 | return; |
| 108 | } |
| 109 | #endif |
| 110 | #if PLATFORM(COCOA) |
| 111 | if (decoder.messageName() == Messages::DrawingArea::AcceleratedAnimationDidStart::name()) { |
| 112 | IPC::handleMessage<Messages::DrawingArea::AcceleratedAnimationDidStart>(decoder, this, &DrawingArea::acceleratedAnimationDidStart); |
| 113 | return; |
| 114 | } |
| 115 | #endif |
| 116 | #if PLATFORM(COCOA) |
| 117 | if (decoder.messageName() == Messages::DrawingArea::AcceleratedAnimationDidEnd::name()) { |
| 118 | IPC::handleMessage<Messages::DrawingArea::AcceleratedAnimationDidEnd>(decoder, this, &DrawingArea::acceleratedAnimationDidEnd); |
| 119 | return; |
| 120 | } |
| 121 | #endif |
| 122 | #if PLATFORM(COCOA) |
| 123 | if (decoder.messageName() == Messages::DrawingArea::AddTransactionCallbackID::name()) { |
| 124 | IPC::handleMessage<Messages::DrawingArea::AddTransactionCallbackID>(decoder, this, &DrawingArea::addTransactionCallbackID); |
| 125 | return; |
| 126 | } |
| 127 | #endif |
| 128 | #if USE(TEXTURE_MAPPER_GL) && PLATFORM(GTK) && PLATFORM(X11) && !USE(REDIRECTED_XCOMPOSITE_WINDOW) |
| 129 | if (decoder.messageName() == Messages::DrawingArea::SetNativeSurfaceHandleForCompositing::name()) { |
| 130 | IPC::handleMessage<Messages::DrawingArea::SetNativeSurfaceHandleForCompositing>(decoder, this, &DrawingArea::setNativeSurfaceHandleForCompositing); |
| 131 | return; |
| 132 | } |
| 133 | #endif |
| 134 | UNUSED_PARAM(connection); |
| 135 | UNUSED_PARAM(decoder); |
| 136 | ASSERT_NOT_REACHED(); |
| 137 | } |
| 138 | |
| 139 | void DrawingArea::didReceiveSyncMessage(IPC::Connection& connection, IPC::Decoder& decoder, std::unique_ptr<IPC::Encoder>& replyEncoder) |
| 140 | { |
| 141 | #if USE(TEXTURE_MAPPER_GL) && PLATFORM(GTK) && PLATFORM(X11) && !USE(REDIRECTED_XCOMPOSITE_WINDOW) |
| 142 | if (decoder.messageName() == Messages::DrawingArea::DestroyNativeSurfaceHandleForCompositing::name()) { |
| 143 | IPC::handleMessage<Messages::DrawingArea::DestroyNativeSurfaceHandleForCompositing>(decoder, *replyEncoder, this, &DrawingArea::destroyNativeSurfaceHandleForCompositing); |
| 144 | return; |
| 145 | } |
| 146 | #endif |
| 147 | UNUSED_PARAM(connection); |
| 148 | UNUSED_PARAM(decoder); |
| 149 | UNUSED_PARAM(replyEncoder); |
| 150 | ASSERT_NOT_REACHED(); |
| 151 | } |
| 152 | |
| 153 | } // namespace WebKit |
| 154 | |
| 155 | |