-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate serialization of WCBackingStore
https://bugs.webkit.org/show_bug.cgi?id=268502 Reviewed by Alex Christensen. Modify `WCBackingStore` so its serialization can be generated. Pass an `ImageBufferBackendHandle` through IPC. Add a constructor to create from a handle, and a method to retrieve a handle from an instance. Adding these allows the serialization framework to work on the class. * Source/WebKit/PlatformWin.cmake: * Source/WebKit/WebProcess/WebPage/wc/WCBackingStore.cpp: Copied from Source/WebKit/WebProcess/WebPage/wc/WCBackingStore.h. (WebKit::WCBackingStore::WCBackingStore): (WebKit::WCBackingStore::handle const): * Source/WebKit/WebProcess/WebPage/wc/WCBackingStore.h: (WebKit::WCBackingStore::encode const): Deleted. (WebKit::WCBackingStore::decode): Deleted. * Source/WebKit/WebProcess/WebPage/wc/WCBackingStore.serialization.in: Added. Canonical link: https://commits.webkit.org/273938@main
- Loading branch information
1 parent
49b7512
commit e45afd8
Showing
4 changed files
with
90 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Copyright (C) 2024 Sony Interactive Entertainment Inc. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* 1. Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | ||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | ||
* THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#include "config.h" | ||
#include "WCBackingStore.h" | ||
|
||
#if USE(GRAPHICS_LAYER_WC) | ||
|
||
#include "ImageBufferBackendHandleSharing.h" | ||
|
||
namespace WebKit { | ||
|
||
WCBackingStore::WCBackingStore(std::optional<ImageBufferBackendHandle>&& handle) | ||
{ | ||
if (auto* imageHandle = handle ? std::get_if<ShareableBitmap::Handle>(&*handle) : nullptr) | ||
m_bitmap = ShareableBitmap::create(WTFMove(*imageHandle)); | ||
} | ||
|
||
std::optional<ImageBufferBackendHandle> WCBackingStore::handle() const | ||
{ | ||
if (!m_imageBuffer) | ||
return std::nullopt; | ||
|
||
auto* sharing = m_imageBuffer->toBackendSharing(); | ||
if (!is<ImageBufferBackendHandleSharing>(sharing)) | ||
return std::nullopt; | ||
|
||
return dynamicDowncast<ImageBufferBackendHandleSharing>(*sharing)->createBackendHandle(); | ||
} | ||
|
||
} // namespace WebKit | ||
|
||
#endif // USE(GRAPHICS_LAYER_WC) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
Source/WebKit/WebProcess/WebPage/wc/WCBackingStore.serialization.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright (C) 2024 Sony Interactive Entertainment Inc. All rights reserved. | ||
# | ||
# Redistribution and use in source and binary forms, with or without | ||
# modification, are permitted provided that the following conditions | ||
# are met: | ||
# 1. Redistributions of source code must retain the above copyright | ||
# notice, this list of conditions and the following disclaimer. | ||
# 2. Redistributions in binary form must reproduce the above copyright | ||
# notice, this list of conditions and the following disclaimer in the | ||
# documentation and/or other materials provided with the distribution. | ||
# | ||
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND | ||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR | ||
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
#if USE(GRAPHICS_LAYER_WC) | ||
|
||
class WebKit::WCBackingStore { | ||
std::optional<WebKit::ImageBufferBackendHandle> handle(); | ||
} | ||
|
||
#endif |