Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(543)

Side by Side Diff: content/common/zygote_fork_delegate_linux.h

Issue 8342017: Add UMA reports for Linux nacl_helper startup status (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased; review nits Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/zygote_main_linux.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_ 5 #ifndef CONTENT_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_
6 #define CONTENT_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_ 6 #define CONTENT_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_
7 #pragma once 7 #pragma once
8 8
9 #include <unistd.h> 9 #include <unistd.h>
10 10
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/basictypes.h" 14 #include "base/basictypes.h"
15 15
16 // The ZygoteForkDelegate allows the Chrome Linux zygote to delegate 16 // The ZygoteForkDelegate allows the Chrome Linux zygote to delegate
17 // fork operations to another class that knows how to do some 17 // fork operations to another class that knows how to do some
18 // specialized version of fork. 18 // specialized version of fork.
19 class ZygoteForkDelegate { 19 class ZygoteForkDelegate {
20 public: 20 public:
21 // A ZygoteForkDelegate is created during Chrome linux zygote 21 // A ZygoteForkDelegate is created during Chrome linux zygote
22 // initialization, and provides "fork()" functionality with 22 // initialization, and provides "fork()" functionality as an
23 // as an alternative to forking the zygote. A new delegate is 23 // alternative to forking the zygote. A new delegate is passed in
24 // passed in as an argument to ZygoteMain(). 24 // as an argument to ZygoteMain().
25 ZygoteForkDelegate() {} 25 ZygoteForkDelegate() {}
26 virtual ~ZygoteForkDelegate() {} 26 virtual ~ZygoteForkDelegate() {}
27 27
28 // Initialization happens in the zygote after it has been 28 // Initialization happens in the zygote after it has been
29 // started by ZygoteMain. 29 // started by ZygoteMain.
30 virtual void Init(bool sandboxed, 30 virtual void Init(bool sandboxed,
31 int browserdesc, 31 int browserdesc,
32 int sandboxdesc) = 0; 32 int sandboxdesc) = 0;
33 33
34 // Returns 'true' if the delegate would like to handle a given 34 // After Init, supply a UMA_HISTOGRAM_ENUMERATION the delegate
35 // fork request. Otherwise returns false. 35 // would like to supply on the first fork.
36 virtual bool CanHelp(const std::string& process_type) = 0; 36 virtual void InitialUMA(std::string* uma_name,
37 int* uma_sample,
38 int* uma_boundary_value) = 0;
39
40 // Returns 'true' if the delegate would like to handle a given fork
41 // request. Otherwise returns false. Optionally, fills in uma_name et al
42 // with a report the helper wants to make via UMA_HISTOGRAM_ENUMERATION.
43 virtual bool CanHelp(const std::string& process_type, std::string* uma_name,
44 int* uma_sample, int* uma_boundary_value) = 0;
37 45
38 // Delegate forks, returning a -1 on failure. Outside the 46 // Delegate forks, returning a -1 on failure. Outside the
39 // suid sandbox, Fork() returns the Linux process ID. Inside 47 // suid sandbox, Fork() returns the Linux process ID. Inside
40 // the sandbox, returns a positive integer, with PID discovery 48 // the sandbox, returns a positive integer, with PID discovery
41 // handled by the sandbox. 49 // handled by the sandbox.
42 virtual pid_t Fork(const std::vector<int>& fds) = 0; 50 virtual pid_t Fork(const std::vector<int>& fds) = 0;
43 51
44 // After a successful for, signal the child to indicate that 52 // After a successful for, signal the child to indicate that
45 // the child's PID has been received. Also communicate the 53 // the child's PID has been received. Also communicate the
46 // channel switch as a part of acknowledgement message. 54 // channel switch as a part of acknowledgement message.
47 virtual bool AckChild(int fd, const std::string& channel_switch) = 0; 55 virtual bool AckChild(int fd, const std::string& channel_switch) = 0;
48 }; 56 };
49 #endif // CONTENT_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_ 57 #endif // CONTENT_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_
OLDNEW
« no previous file with comments | « content/browser/zygote_main_linux.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698