1 // Copyright (c) 2011 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 CHROME_APP_NACL_FORK_DELEGATE_LINUX_H_
6 #define CHROME_APP_NACL_FORK_DELEGATE_LINUX_H_
9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h"
11 #include "content/public/common/zygote_fork_delegate_linux.h"
13 // The NaClForkDelegate is created during Chrome linux zygote
14 // initialization, and provides "fork()" functionality with
15 // NaCl specific process characteristics (specifically address
16 // space layout) as an alternative to forking the zygote.
17 // A new delegate is passed in as an argument to ZygoteMain().
18 class NaClForkDelegate
: public content::ZygoteForkDelegate
{
21 virtual ~NaClForkDelegate();
23 virtual void Init(bool sandboxed
,
25 int sandboxdesc
) OVERRIDE
;
26 virtual void InitialUMA(std::string
* uma_name
,
28 int* uma_boundary_value
) OVERRIDE
;
29 virtual bool CanHelp(const std::string
& process_type
, std::string
* uma_name
,
30 int* uma_sample
, int* uma_boundary_value
) OVERRIDE
;
31 virtual pid_t
Fork(const std::vector
<int>& fds
) OVERRIDE
;
32 virtual bool AckChild(int fd
,
33 const std::string
& channel_switch
) OVERRIDE
;
36 // These values are reported via UMA and hence they become permanent
37 // constants. Old values cannot be reused, only new ones added.
38 enum NaClHelperStatus
{
39 kNaClHelperUnused
= 0,
40 kNaClHelperMissing
= 1,
41 kNaClHelperBootstrapMissing
= 2,
42 kNaClHelperValgrind
= 3,
43 kNaClHelperLaunchFailed
= 4,
44 kNaClHelperAckFailed
= 5,
45 kNaClHelperSuccess
= 6,
46 kNaClHelperStatusBoundary
// Must be one greater than highest value used.
49 NaClHelperStatus status_
;
54 #endif // CHROME_APP_NACL_FORK_DELEGATE_LINUX_H_