-
Notifications
You must be signed in to change notification settings - Fork 15k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
277facc
commit 5f8e796
Showing
18 changed files
with
195 additions
and
34 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
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
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
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
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
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,32 @@ | ||
// Copyright (c) 2022 Microsoft, Inc. | ||
// Use of this source code is governed by the MIT license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "shell/browser/node_service_host_impl.h" | ||
|
||
#include <utility> | ||
|
||
#include "shell/browser/api/electron_api_utility_process.h" | ||
|
||
namespace electron { | ||
|
||
NodeServiceHostImpl::NodeServiceHostImpl() = default; | ||
|
||
NodeServiceHostImpl::~NodeServiceHostImpl() = default; | ||
|
||
void NodeServiceHostImpl::BindReceiver( | ||
mojo::PendingReceiver<node::mojom::NodeServiceHost> receiver) { | ||
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); | ||
receivers_.Add(this, std::move(receiver)); | ||
} | ||
|
||
void NodeServiceHostImpl::ReceivePostMessage( | ||
base::ProcessId pid, | ||
blink::TransferableMessage message) { | ||
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); | ||
auto* utility_process_wrapper = GetAllUtilityProcessWrappers().Lookup(pid); | ||
if (utility_process_wrapper) | ||
utility_process_wrapper->ReceivePostMessage(std::move(message)); | ||
} | ||
|
||
} // namespace electron |
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,38 @@ | ||
// Copyright (c) 2022 Microsoft, Inc. | ||
// Use of this source code is governed by the MIT license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef ELECTRON_SHELL_BROWSER_NODE_SERVICE_HOST_IMPL_H_ | ||
#define ELECTRON_SHELL_BROWSER_NODE_SERVICE_HOST_IMPL_H_ | ||
|
||
#include "base/sequence_checker.h" | ||
#include "mojo/public/cpp/bindings/pending_receiver.h" | ||
#include "mojo/public/cpp/bindings/receiver_set.h" | ||
#include "shell/services/node/public/mojom/node_service.mojom.h" | ||
|
||
namespace electron { | ||
|
||
class NodeServiceHostImpl : public node::mojom::NodeServiceHost { | ||
public: | ||
NodeServiceHostImpl(); | ||
|
||
NodeServiceHostImpl(const NodeServiceHostImpl&) = delete; | ||
NodeServiceHostImpl& operator=(const NodeServiceHostImpl&) = delete; | ||
|
||
~NodeServiceHostImpl() override; | ||
|
||
void BindReceiver( | ||
mojo::PendingReceiver<node::mojom::NodeServiceHost> receiver); | ||
|
||
// node::mojom::NodeServiceHost: | ||
void ReceivePostMessage(base::ProcessId pid, | ||
blink::TransferableMessage message) override; | ||
|
||
private: | ||
mojo::ReceiverSet<node::mojom::NodeServiceHost> receivers_; | ||
SEQUENCE_CHECKER(sequence_checker_); | ||
}; | ||
|
||
} // namespace electron | ||
|
||
#endif // ELECTRON_SHELL_BROWSER_NODE_SERVICE_HOST_IMPL_H_ |
Oops, something went wrong.