2828#include " absl/status/status.h"
2929#include " absl/status/status_macros.h"
3030#include " absl/status/statusor.h"
31- #include " absl/strings/string_view.h"
3231#include " absl/time/time.h"
3332#include " absl/types/span.h"
3433#include " sandboxed_api/call.h"
4039#include " sandboxed_api/vars.h"
4140
4241namespace sapi {
43-
4442namespace sandbox_internal {
4543
4644class PtrOrCallable {
@@ -66,7 +64,7 @@ class PtrOrCallable {
6664// means to communicate with it (make function calls, transfer memory).
6765class SandboxBase {
6866 public:
69- explicit SandboxBase (std::string name = " unknown " ) : name_(std::move(name)) {}
67+ SandboxBase () = default ;
7068
7169 virtual ~SandboxBase () = default ;
7270
@@ -158,8 +156,6 @@ class SandboxBase {
158156 // sandboxee is not running or we're using an in-process sandbox.
159157 virtual absl::StatusOr<int > GetPid () const = 0;
160158
161- const std::string& name () const { return name_; }
162-
163159 protected:
164160 // WrapCallStatus is called with the status returned by a Call. The default
165161 // implementation simply returns the status as is.
@@ -170,7 +166,6 @@ class SandboxBase {
170166 absl::Status Call (
171167 const std::string& func, v::Callable* ret,
172168 std::initializer_list<sandbox_internal::PtrOrCallable> args);
173- std::string name_;
174169};
175170
176171// The Sandbox class represents the sandboxed library. It provides users with
@@ -179,26 +174,23 @@ template <typename Backend>
179174class Sandbox : public SandboxBase {
180175 public:
181176 explicit Sandbox (SandboxConfig config)
182- : SandboxBase(config.name ), backend_(std::move(config), [this] {
177+ : SandboxBase(), backend_(std::move(config), [this] {
183178 return CreateNotifier (); // NOLINT
184179 }) {}
185180
186181 // This constructor should only be used for special cases, e.g. when using the
187182 // CreateNotifier() method of the Sandbox2Backend. Otherwise, prefer to use
188183 // the SandboxConfig constructor above.
189184 explicit Sandbox (Backend backend)
190- : SandboxBase(backend.name() ), backend_(std::move(backend)) {}
185+ : SandboxBase(), backend_(std::move(backend)) {}
191186
192187 Sandbox (const Sandbox&) = delete ;
193188 Sandbox& operator =(const Sandbox&) = delete ;
194189
195190 virtual ~Sandbox () = default ;
196191
197192 // Initializes a new sandboxing session.
198- absl::Status Init () override {
199- ABSL_RETURN_IF_ERROR (backend ().Init ());
200- return absl::OkStatus ();
201- }
193+ absl::Status Init () override { return backend ().Init (); }
202194
203195 // Returns whether the current sandboxing session is active.
204196 bool is_active () const override { return backend ().is_active (); }
0 commit comments