| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BROWSER_ZYGOTE_HOST_ZYGOTE_HOST_IMPL_LINUX_H_ | 5 #ifndef CONTENT_BROWSER_ZYGOTE_HOST_ZYGOTE_HOST_IMPL_LINUX_H_ |
| 6 #define CONTENT_BROWSER_ZYGOTE_HOST_ZYGOTE_HOST_IMPL_LINUX_H_ | 6 #define CONTENT_BROWSER_ZYGOTE_HOST_ZYGOTE_HOST_IMPL_LINUX_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/pickle.h" | 12 #include "base/pickle.h" |
| 13 #include "base/process/kill.h" | 13 #include "base/process/kill.h" |
| 14 #include "base/synchronization/lock.h" | 14 #include "base/synchronization/lock.h" |
| 15 #include "content/public/browser/file_descriptor_info.h" | 15 #include "content/public/browser/file_descriptor_info.h" |
| 16 #include "content/public/browser/zygote_host_linux.h" | 16 #include "content/public/browser/zygote_host_linux.h" |
| 17 | 17 |
| 18 namespace base { |
| 18 template<typename Type> | 19 template<typename Type> |
| 19 struct DefaultSingletonTraits; | 20 struct DefaultSingletonTraits; |
| 21 } // namespace base |
| 20 | 22 |
| 21 namespace content { | 23 namespace content { |
| 22 | 24 |
| 23 class CONTENT_EXPORT ZygoteHostImpl : public ZygoteHost { | 25 class CONTENT_EXPORT ZygoteHostImpl : public ZygoteHost { |
| 24 public: | 26 public: |
| 25 // Returns the singleton instance. | 27 // Returns the singleton instance. |
| 26 static ZygoteHostImpl* GetInstance(); | 28 static ZygoteHostImpl* GetInstance(); |
| 27 | 29 |
| 28 void Init(const std::string& sandbox_cmd); | 30 void Init(const std::string& sandbox_cmd); |
| 29 | 31 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 53 bool known_dead, | 55 bool known_dead, |
| 54 int* exit_code); | 56 int* exit_code); |
| 55 | 57 |
| 56 // ZygoteHost implementation: | 58 // ZygoteHost implementation: |
| 57 pid_t GetPid() const override; | 59 pid_t GetPid() const override; |
| 58 int GetSandboxStatus() const override; | 60 int GetSandboxStatus() const override; |
| 59 void AdjustRendererOOMScore(base::ProcessHandle process_handle, | 61 void AdjustRendererOOMScore(base::ProcessHandle process_handle, |
| 60 int score) override; | 62 int score) override; |
| 61 | 63 |
| 62 private: | 64 private: |
| 63 friend struct DefaultSingletonTraits<ZygoteHostImpl>; | 65 friend struct base::DefaultSingletonTraits<ZygoteHostImpl>; |
| 64 | 66 |
| 65 ZygoteHostImpl(); | 67 ZygoteHostImpl(); |
| 66 ~ZygoteHostImpl() override; | 68 ~ZygoteHostImpl() override; |
| 67 | 69 |
| 68 // Notify the Zygote to exit immediately. This object should not be | 70 // Notify the Zygote to exit immediately. This object should not be |
| 69 // used afterwards. | 71 // used afterwards. |
| 70 void TearDown(); | 72 void TearDown(); |
| 71 | 73 |
| 72 // Should be called every time a Zygote child is born. | 74 // Should be called every time a Zygote child is born. |
| 73 void ZygoteChildBorn(pid_t process); | 75 void ZygoteChildBorn(pid_t process); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 99 // A lock protecting list_of_running_zygote_children_ and | 101 // A lock protecting list_of_running_zygote_children_ and |
| 100 // should_teardown_after_last_child_exits_. | 102 // should_teardown_after_last_child_exits_. |
| 101 base::Lock child_tracking_lock_; | 103 base::Lock child_tracking_lock_; |
| 102 std::set<pid_t> list_of_running_zygote_children_; | 104 std::set<pid_t> list_of_running_zygote_children_; |
| 103 bool should_teardown_after_last_child_exits_; | 105 bool should_teardown_after_last_child_exits_; |
| 104 }; | 106 }; |
| 105 | 107 |
| 106 } // namespace content | 108 } // namespace content |
| 107 | 109 |
| 108 #endif // CONTENT_BROWSER_ZYGOTE_HOST_ZYGOTE_HOST_IMPL_LINUX_H_ | 110 #endif // CONTENT_BROWSER_ZYGOTE_HOST_ZYGOTE_HOST_IMPL_LINUX_H_ |
| OLD | NEW |