From 376ca05c5618b7648b39555e1f91a1beadaf90b9 Mon Sep 17 00:00:00 2001 From: Sandboxed API Team Date: Mon, 28 Sep 2020 07:38:07 -0700 Subject: [PATCH] Allow sandboxes to specify custom notifiers. PiperOrigin-RevId: 334154462 Change-Id: Ia62242913731ab017a9bf8733a77a647582af243 --- sandboxed_api/sandbox.cc | 2 +- sandboxed_api/sandbox.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/sandboxed_api/sandbox.cc b/sandboxed_api/sandbox.cc index d6b1bf2..cfa7dca 100644 --- a/sandboxed_api/sandbox.cc +++ b/sandboxed_api/sandbox.cc @@ -201,7 +201,7 @@ absl::Status Sandbox::Init() { ModifyExecutor(executor.get()); s2_ = absl::make_unique(std::move(executor), - std::move(s2p)); + std::move(s2p), CreateNotifier()); auto res = s2_->RunAsync(); comms_ = s2_->comms(); diff --git a/sandboxed_api/sandbox.h b/sandboxed_api/sandbox.h index 576a144..8be0bd7 100644 --- a/sandboxed_api/sandbox.h +++ b/sandboxed_api/sandbox.h @@ -141,6 +141,9 @@ class Sandbox { // Modifies the Executor object if needed. virtual void ModifyExecutor(sandbox2::Executor* executor) {} + // Provides a custom notifier for sandboxee events. May return nullptr. + virtual std::unique_ptr CreateNotifier() { return nullptr; } + // Exits the sandboxee. void Exit() const;