 Chromium Code Reviews
 Chromium Code Reviews Issue 1018953004:
  Add SeccompSupportDetector for Android.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 1018953004:
  Add SeccompSupportDetector for Android.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| OLD | NEW | 
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_ANDROID_SECCOMP_SUPPORT_DETECTOR_H_ | |
| 6 #define CHROME_BROWSER_ANDROID_SECCOMP_SUPPORT_DETECTOR_H_ | |
| 7 | |
| 8 #include "base/compiler_specific.h" | |
| 9 #include "content/public/browser/utility_process_host_client.h" | |
| 10 | |
| 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 FILE | |
| 13 // thread, while seccomp support is tested in a utility process, in case | |
| 14 // the probing causes a crash. | |
| 15 class SeccompSupportDetector : public content::UtilityProcessHostClient { | |
| 16 public: | |
| 17 // Starts the detection process. This should be called once per browser | |
| 18 // session. This is safe to call from any thread. | |
| 19 static void StartDetection(); | |
| 20 | |
| 21 private: | |
| 22 SeccompSupportDetector(); | |
| 23 ~SeccompSupportDetector() override; | |
| 24 | |
| 25 // Called on the FILE thread. This reads the utsname and records the kernel | |
| 
Lei Zhang
2015/03/19 18:32:04
s/FILE thread/blocking thread pool/
 
Robert Sesek
2015/03/19 19:37:16
Done.
 | |
| 26 // version. | |
| 27 void DetectKernelVersion(); | |
| 28 | |
| 29 // Called on the IO thread. This starts a utility process to detect seccomp. | |
| 30 void DetectSeccomp(); | |
| 31 | |
| 32 // UtilityProcessHostClient: | |
| 33 void OnProcessCrashed(int exit_code) override; | |
| 34 bool OnMessageReceived(const IPC::Message& message) override; | |
| 35 | |
| 36 // OnDetectPrctl is always received before OnDetectSyscall. | |
| 37 void OnDetectPrctl(bool prctl_supported); | |
| 38 void OnDetectSyscall(bool syscall_supported); | |
| 39 | |
| 40 // Whether OnDetectPrctl was received. | |
| 41 bool prctl_detected_; | |
| 42 | |
| 43 DISALLOW_COPY_AND_ASSIGN(SeccompSupportDetector); | |
| 44 }; | |
| 45 | |
| 46 #endif // CHROME_BROWSER_ANDROID_SECCOMP_SUPPORT_DETECTOR_H_ | |
| OLD | NEW |