| 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 | #pragma once |
| 26 | |
| 27 | #include "ArgumentCoders.h" |
| 28 | #include "Connection.h" |
| 29 | #include <WebCore/FloatRect.h> |
| 30 | #include <wtf/Forward.h> |
| 31 | #include <wtf/MachSendRight.h> |
| 32 | #include <wtf/Optional.h> |
| 33 | #include <wtf/ThreadSafeRefCounted.h> |
| 34 | #include <wtf/text/WTFString.h> |
| 35 | |
| 36 | namespace WebCore { |
| 37 | class FloatPoint; |
| 38 | class IntSize; |
| 39 | } |
| 40 | |
| 41 | namespace WebKit { |
| 42 | struct ColorSpaceData; |
| 43 | class CallbackID; |
| 44 | } |
| 45 | |
| 46 | namespace Messages { |
| 47 | namespace DrawingArea { |
| 48 | |
| 49 | static inline IPC::StringReference messageReceiverName() |
| 50 | { |
| 51 | return IPC::StringReference("DrawingArea" ); |
| 52 | } |
| 53 | |
| 54 | class UpdateBackingStoreState { |
| 55 | public: |
| 56 | typedef std::tuple<uint64_t, bool, float, const WebCore::IntSize&, const WebCore::IntSize&> Arguments; |
| 57 | |
| 58 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
| 59 | static IPC::StringReference name() { return IPC::StringReference("UpdateBackingStoreState" ); } |
| 60 | static const bool isSync = false; |
| 61 | |
| 62 | UpdateBackingStoreState(uint64_t backingStoreStateID, bool respondImmediately, float deviceScaleFactor, const WebCore::IntSize& size, const WebCore::IntSize& scrollOffset) |
| 63 | : m_arguments(backingStoreStateID, respondImmediately, deviceScaleFactor, size, scrollOffset) |
| 64 | { |
| 65 | } |
| 66 | |
| 67 | const Arguments& arguments() const |
| 68 | { |
| 69 | return m_arguments; |
| 70 | } |
| 71 | |
| 72 | private: |
| 73 | Arguments m_arguments; |
| 74 | }; |
| 75 | |
| 76 | class DidUpdate { |
| 77 | public: |
| 78 | typedef std::tuple<> Arguments; |
| 79 | |
| 80 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
| 81 | static IPC::StringReference name() { return IPC::StringReference("DidUpdate" ); } |
| 82 | static const bool isSync = false; |
| 83 | |
| 84 | const Arguments& arguments() const |
| 85 | { |
| 86 | return m_arguments; |
| 87 | } |
| 88 | |
| 89 | private: |
| 90 | Arguments m_arguments; |
| 91 | }; |
| 92 | |
| 93 | #if PLATFORM(COCOA) |
| 94 | class UpdateGeometry { |
| 95 | public: |
| 96 | typedef std::tuple<const WebCore::IntSize&, bool, const MachSendRight&> Arguments; |
| 97 | |
| 98 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
| 99 | static IPC::StringReference name() { return IPC::StringReference("UpdateGeometry" ); } |
| 100 | static const bool isSync = false; |
| 101 | |
| 102 | UpdateGeometry(const WebCore::IntSize& viewSize, bool flushSynchronously, const MachSendRight& fencePort) |
| 103 | : m_arguments(viewSize, flushSynchronously, fencePort) |
| 104 | { |
| 105 | } |
| 106 | |
| 107 | const Arguments& arguments() const |
| 108 | { |
| 109 | return m_arguments; |
| 110 | } |
| 111 | |
| 112 | private: |
| 113 | Arguments m_arguments; |
| 114 | }; |
| 115 | #endif |
| 116 | |
| 117 | #if PLATFORM(COCOA) |
| 118 | class SetDeviceScaleFactor { |
| 119 | public: |
| 120 | typedef std::tuple<float> Arguments; |
| 121 | |
| 122 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
| 123 | static IPC::StringReference name() { return IPC::StringReference("SetDeviceScaleFactor" ); } |
| 124 | static const bool isSync = false; |
| 125 | |
| 126 | explicit SetDeviceScaleFactor(float deviceScaleFactor) |
| 127 | : m_arguments(deviceScaleFactor) |
| 128 | { |
| 129 | } |
| 130 | |
| 131 | const Arguments& arguments() const |
| 132 | { |
| 133 | return m_arguments; |
| 134 | } |
| 135 | |
| 136 | private: |
| 137 | Arguments m_arguments; |
| 138 | }; |
| 139 | #endif |
| 140 | |
| 141 | #if PLATFORM(COCOA) |
| 142 | class SetColorSpace { |
| 143 | public: |
| 144 | typedef std::tuple<const WebKit::ColorSpaceData&> Arguments; |
| 145 | |
| 146 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
| 147 | static IPC::StringReference name() { return IPC::StringReference("SetColorSpace" ); } |
| 148 | static const bool isSync = false; |
| 149 | |
| 150 | explicit SetColorSpace(const WebKit::ColorSpaceData& colorSpace) |
| 151 | : m_arguments(colorSpace) |
| 152 | { |
| 153 | } |
| 154 | |
| 155 | const Arguments& arguments() const |
| 156 | { |
| 157 | return m_arguments; |
| 158 | } |
| 159 | |
| 160 | private: |
| 161 | Arguments m_arguments; |
| 162 | }; |
| 163 | #endif |
| 164 | |
| 165 | #if PLATFORM(COCOA) |
| 166 | class SetViewExposedRect { |
| 167 | public: |
| 168 | typedef std::tuple<const Optional<WebCore::FloatRect>&> Arguments; |
| 169 | |
| 170 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
| 171 | static IPC::StringReference name() { return IPC::StringReference("SetViewExposedRect" ); } |
| 172 | static const bool isSync = false; |
| 173 | |
| 174 | explicit SetViewExposedRect(const Optional<WebCore::FloatRect>& viewExposedRect) |
| 175 | : m_arguments(viewExposedRect) |
| 176 | { |
| 177 | } |
| 178 | |
| 179 | const Arguments& arguments() const |
| 180 | { |
| 181 | return m_arguments; |
| 182 | } |
| 183 | |
| 184 | private: |
| 185 | Arguments m_arguments; |
| 186 | }; |
| 187 | #endif |
| 188 | |
| 189 | #if PLATFORM(COCOA) |
| 190 | class AdjustTransientZoom { |
| 191 | public: |
| 192 | typedef std::tuple<double, const WebCore::FloatPoint&> Arguments; |
| 193 | |
| 194 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
| 195 | static IPC::StringReference name() { return IPC::StringReference("AdjustTransientZoom" ); } |
| 196 | static const bool isSync = false; |
| 197 | |
| 198 | AdjustTransientZoom(double scale, const WebCore::FloatPoint& origin) |
| 199 | : m_arguments(scale, origin) |
| 200 | { |
| 201 | } |
| 202 | |
| 203 | const Arguments& arguments() const |
| 204 | { |
| 205 | return m_arguments; |
| 206 | } |
| 207 | |
| 208 | private: |
| 209 | Arguments m_arguments; |
| 210 | }; |
| 211 | #endif |
| 212 | |
| 213 | #if PLATFORM(COCOA) |
| 214 | class CommitTransientZoom { |
| 215 | public: |
| 216 | typedef std::tuple<double, const WebCore::FloatPoint&> Arguments; |
| 217 | |
| 218 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
| 219 | static IPC::StringReference name() { return IPC::StringReference("CommitTransientZoom" ); } |
| 220 | static const bool isSync = false; |
| 221 | |
| 222 | CommitTransientZoom(double scale, const WebCore::FloatPoint& origin) |
| 223 | : m_arguments(scale, origin) |
| 224 | { |
| 225 | } |
| 226 | |
| 227 | const Arguments& arguments() const |
| 228 | { |
| 229 | return m_arguments; |
| 230 | } |
| 231 | |
| 232 | private: |
| 233 | Arguments m_arguments; |
| 234 | }; |
| 235 | #endif |
| 236 | |
| 237 | #if PLATFORM(COCOA) |
| 238 | class AcceleratedAnimationDidStart { |
| 239 | public: |
| 240 | typedef std::tuple<uint64_t, const String&, const MonotonicTime&> Arguments; |
| 241 | |
| 242 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
| 243 | static IPC::StringReference name() { return IPC::StringReference("AcceleratedAnimationDidStart" ); } |
| 244 | static const bool isSync = false; |
| 245 | |
| 246 | AcceleratedAnimationDidStart(uint64_t layerID, const String& key, const MonotonicTime& startTime) |
| 247 | : m_arguments(layerID, key, startTime) |
| 248 | { |
| 249 | } |
| 250 | |
| 251 | const Arguments& arguments() const |
| 252 | { |
| 253 | return m_arguments; |
| 254 | } |
| 255 | |
| 256 | private: |
| 257 | Arguments m_arguments; |
| 258 | }; |
| 259 | #endif |
| 260 | |
| 261 | #if PLATFORM(COCOA) |
| 262 | class AcceleratedAnimationDidEnd { |
| 263 | public: |
| 264 | typedef std::tuple<uint64_t, const String&> Arguments; |
| 265 | |
| 266 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
| 267 | static IPC::StringReference name() { return IPC::StringReference("AcceleratedAnimationDidEnd" ); } |
| 268 | static const bool isSync = false; |
| 269 | |
| 270 | AcceleratedAnimationDidEnd(uint64_t layerID, const String& key) |
| 271 | : m_arguments(layerID, key) |
| 272 | { |
| 273 | } |
| 274 | |
| 275 | const Arguments& arguments() const |
| 276 | { |
| 277 | return m_arguments; |
| 278 | } |
| 279 | |
| 280 | private: |
| 281 | Arguments m_arguments; |
| 282 | }; |
| 283 | #endif |
| 284 | |
| 285 | #if PLATFORM(COCOA) |
| 286 | class AddTransactionCallbackID { |
| 287 | public: |
| 288 | typedef std::tuple<const WebKit::CallbackID&> Arguments; |
| 289 | |
| 290 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
| 291 | static IPC::StringReference name() { return IPC::StringReference("AddTransactionCallbackID" ); } |
| 292 | static const bool isSync = false; |
| 293 | |
| 294 | explicit AddTransactionCallbackID(const WebKit::CallbackID& callbackID) |
| 295 | : m_arguments(callbackID) |
| 296 | { |
| 297 | } |
| 298 | |
| 299 | const Arguments& arguments() const |
| 300 | { |
| 301 | return m_arguments; |
| 302 | } |
| 303 | |
| 304 | private: |
| 305 | Arguments m_arguments; |
| 306 | }; |
| 307 | #endif |
| 308 | |
| 309 | #if USE(TEXTURE_MAPPER_GL) && PLATFORM(GTK) && PLATFORM(X11) && !USE(REDIRECTED_XCOMPOSITE_WINDOW) |
| 310 | class SetNativeSurfaceHandleForCompositing { |
| 311 | public: |
| 312 | typedef std::tuple<uint64_t> Arguments; |
| 313 | |
| 314 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
| 315 | static IPC::StringReference name() { return IPC::StringReference("SetNativeSurfaceHandleForCompositing" ); } |
| 316 | static const bool isSync = false; |
| 317 | |
| 318 | explicit SetNativeSurfaceHandleForCompositing(uint64_t handle) |
| 319 | : m_arguments(handle) |
| 320 | { |
| 321 | } |
| 322 | |
| 323 | const Arguments& arguments() const |
| 324 | { |
| 325 | return m_arguments; |
| 326 | } |
| 327 | |
| 328 | private: |
| 329 | Arguments m_arguments; |
| 330 | }; |
| 331 | #endif |
| 332 | |
| 333 | #if USE(TEXTURE_MAPPER_GL) && PLATFORM(GTK) && PLATFORM(X11) && !USE(REDIRECTED_XCOMPOSITE_WINDOW) |
| 334 | class DestroyNativeSurfaceHandleForCompositing { |
| 335 | public: |
| 336 | typedef std::tuple<> Arguments; |
| 337 | |
| 338 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
| 339 | static IPC::StringReference name() { return IPC::StringReference("DestroyNativeSurfaceHandleForCompositing" ); } |
| 340 | static const bool isSync = true; |
| 341 | |
| 342 | using Reply = std::tuple<bool&>; |
| 343 | using ReplyArguments = std::tuple<bool>; |
| 344 | const Arguments& arguments() const |
| 345 | { |
| 346 | return m_arguments; |
| 347 | } |
| 348 | |
| 349 | private: |
| 350 | Arguments m_arguments; |
| 351 | }; |
| 352 | #endif |
| 353 | |
| 354 | } // namespace DrawingArea |
| 355 | } // namespace Messages |
| 356 | |