1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef BASE_FUCHSIA_DEFAULT_JOB_H_
6 #define BASE_FUCHSIA_DEFAULT_JOB_H_
8 #include <lib/zx/job.h>
10 #include "base/base_export.h"
11 #include "base/macros.h"
15 // Gets and sets the job object used for creating new child processes,
16 // and looking them up by their process IDs.
17 // zx::job::default_job() will be returned if no job is explicitly set here.
18 // Only valid handles may be passed to SetDefaultJob().
19 BASE_EXPORT zx::unowned_job GetDefaultJob();
20 BASE_EXPORT void SetDefaultJob(zx::job job);
22 // Replaces the current default job (if any) with the specified zx::job, and
23 // restores the original default job when going out-of-scope.
24 // Note that replacing the default job is not thread-safe!
25 class BASE_EXPORT ScopedDefaultJobForTest {
27 ScopedDefaultJobForTest(zx::job new_default_job);
28 ~ScopedDefaultJobForTest();
31 zx::job old_default_job_;
32 DISALLOW_COPY_AND_ASSIGN(ScopedDefaultJobForTest);
37 #endif // BASE_FUCHSIA_DEFAULT_JOB_H_