-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make SubtleCrypto use Bun WorkPool instead of WTF::WorkQueue
- Loading branch information
Showing
5 changed files
with
67 additions
and
2 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,23 @@ | ||
#include "PhonyWorkQueue.h" | ||
|
||
#include <wtf/text/ASCIILiteral.h> | ||
#include "EventLoopTask.h" | ||
|
||
using WebCore::EventLoopTask; | ||
|
||
namespace Bun { | ||
|
||
Ref<PhonyWorkQueue> PhonyWorkQueue::create(WTF::ASCIILiteral name) | ||
{ | ||
(void)name; | ||
return adoptRef(*new PhonyWorkQueue); | ||
} | ||
|
||
extern "C" void ConcurrentCppTask__createAndRun(EventLoopTask*); | ||
|
||
void PhonyWorkQueue::dispatch(WTF::Function<void()>&& function) | ||
{ | ||
ConcurrentCppTask__createAndRun(new EventLoopTask(WTFMove(function))); | ||
} | ||
|
||
} // namespace Bun |
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,20 @@ | ||
#pragma once | ||
|
||
#include "root.h" | ||
|
||
#include <wtf/RefCounted.h> | ||
#include <wtf/Ref.h> | ||
|
||
namespace Bun { | ||
|
||
// Work queue which really uses CppTask.Concurrent in Bun's event loop (which enqueues into a WorkPool). | ||
// Maintained so that SubtleCrypto functions can pretend they're using a WorkQueue, even though | ||
// WTF::WorkQueue doesn't work and we need to use Bun's equivalent. | ||
class PhonyWorkQueue : public WTF::RefCounted<PhonyWorkQueue> { | ||
public: | ||
static Ref<PhonyWorkQueue> create(WTF::ASCIILiteral name); | ||
|
||
void dispatch(Function<void()>&&); | ||
}; | ||
|
||
}; // namespace Bun |
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