mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 08:54:58 +00:00
Ladybird+LibWebView+WebContent: Make the screenshot IPCs async
These IPCs are different than other IPCs in that we can't just set up a callback function to be invoked when WebContent sends us the screenshot data. There are multiple places that would set that callback, and they would step on each other's toes. Instead, the screenshot APIs on ViewImplementation now return a Promise which callers can interact with to receive the screenshot (or an error).
This commit is contained in:
parent
93db790974
commit
d8fa226a8f
13 changed files with 121 additions and 47 deletions
|
@ -11,6 +11,7 @@
|
|||
#include <AK/Function.h>
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibCore/Promise.h>
|
||||
#include <LibGfx/Forward.h>
|
||||
#include <LibGfx/StandardCursor.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
|
@ -95,8 +96,9 @@ public:
|
|||
Visible,
|
||||
Full,
|
||||
};
|
||||
ErrorOr<LexicalPath> take_screenshot(ScreenshotType);
|
||||
ErrorOr<LexicalPath> take_dom_node_screenshot(i32);
|
||||
NonnullRefPtr<Core::Promise<LexicalPath>> take_screenshot(ScreenshotType);
|
||||
NonnullRefPtr<Core::Promise<LexicalPath>> take_dom_node_screenshot(i32);
|
||||
virtual void did_receive_screenshot(Badge<WebContentClient>, Gfx::ShareableBitmap const&);
|
||||
|
||||
ErrorOr<LexicalPath> dump_gc_graph();
|
||||
|
||||
|
@ -229,6 +231,8 @@ protected:
|
|||
|
||||
size_t m_crash_count = 0;
|
||||
RefPtr<Core::Timer> m_repeated_crash_timer;
|
||||
|
||||
RefPtr<Core::Promise<LexicalPath>> m_pending_screenshot;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue