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

Side by Side Diff: chrome/browser/android/seccomp_support_detector.h

Issue 1161053004: Move the SeccompSupportDetector to be in-process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 CHROME_BROWSER_ANDROID_SECCOMP_SUPPORT_DETECTOR_H_ 5 #ifndef CHROME_BROWSER_ANDROID_SECCOMP_SUPPORT_DETECTOR_H_
6 #define CHROME_BROWSER_ANDROID_SECCOMP_SUPPORT_DETECTOR_H_ 6 #define CHROME_BROWSER_ANDROID_SECCOMP_SUPPORT_DETECTOR_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "content/public/browser/utility_process_host_client.h" 9 #include "base/memory/ref_counted.h"
10 10
11 // This class is used to report via UMA the Android kernel version and 11 // This class is used to report via UMA the Android kernel version and
12 // level of seccomp-bpf support. The kernel version is read from the blocking 12 // level of seccomp-bpf support. The operations are performed on the
13 // thread pool, while seccomp support is tested in a utility process, in case 13 // blocking thread pool.
14 // the probing causes a crash. 14 class SeccompSupportDetector
15 class SeccompSupportDetector : public content::UtilityProcessHostClient { 15 : public base::RefCountedThreadSafe<SeccompSupportDetector> {
16 public: 16 public:
17 // Starts the detection process. This should be called once per browser 17 // Starts the detection process. This should be called once per browser
18 // session. This is safe to call from any thread. 18 // session. This is safe to call from any thread.
19 static void StartDetection(); 19 static void StartDetection();
20 20
21 private: 21 private:
22 friend class base::RefCountedThreadSafe<SeccompSupportDetector>;
23
22 SeccompSupportDetector(); 24 SeccompSupportDetector();
23 ~SeccompSupportDetector() override; 25 ~SeccompSupportDetector();
24 26
25 // Called on the blocking thread pool. This reads the utsname and records 27 // Called on the blocking thread pool. This reads the utsname and records
26 // the kernel version. 28 // the kernel version.
27 void DetectKernelVersion(); 29 void DetectKernelVersion();
28 30
29 // Called on the IO thread. This starts a utility process to detect seccomp. 31 // Called on the blocking thread pool. This tests whether the system
32 // supports PR_SET_SECCOMP.
30 void DetectSeccomp(); 33 void DetectSeccomp();
31 34
32 // UtilityProcessHostClient:
33 void OnProcessCrashed(int exit_code) override;
34 bool OnMessageReceived(const IPC::Message& message) override;
35
36 void OnDetectPrctl(bool prctl_supported);
37
38 DISALLOW_COPY_AND_ASSIGN(SeccompSupportDetector); 35 DISALLOW_COPY_AND_ASSIGN(SeccompSupportDetector);
39 }; 36 };
40 37
41 #endif // CHROME_BROWSER_ANDROID_SECCOMP_SUPPORT_DETECTOR_H_ 38 #endif // CHROME_BROWSER_ANDROID_SECCOMP_SUPPORT_DETECTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698