Chromium Code Reviews| Index: content/browser/zygote_host/zygote_handle_linux.cc |
| diff --git a/content/browser/zygote_host/zygote_handle_linux.cc b/content/browser/zygote_host/zygote_handle_linux.cc |
| index 55830f57487209651585838f1271d8b4ceb4efb9..61780112eca95e423c1f20e35c832c7534525078 100644 |
| --- a/content/browser/zygote_host/zygote_handle_linux.cc |
| +++ b/content/browser/zygote_host/zygote_handle_linux.cc |
| @@ -7,16 +7,23 @@ |
| #include "content/browser/zygote_host/zygote_communication_linux.h" |
| namespace content { |
| +namespace { |
| -ZygoteHandle CreateZygote() { |
| - ZygoteHandle zygote = new ZygoteCommunication(); |
| - zygote->Init(); |
| - return zygote; |
| +// Intentionally leaked. |
|
James Cook
2017/04/28 20:07:52
The old code leaks the ZygoteCommunication object.
mdempsky
2017/04/28 22:13:45
By "leaks" do you mean that it's not destroyed whe
|
| +ZygoteHandle g_generic_zygote = nullptr; |
| + |
| +} // namespace |
| + |
| +ZygoteHandle CreateGenericZygote() { |
| + CHECK(!g_generic_zygote); |
| + g_generic_zygote = new ZygoteCommunication(); |
| + g_generic_zygote->Init(); |
| + return g_generic_zygote; |
| } |
| -ZygoteHandle* GetGenericZygote() { |
| - static ZygoteHandle zygote; |
| - return &zygote; |
| +ZygoteHandle GetGenericZygote() { |
| + CHECK(g_generic_zygote); |
| + return g_generic_zygote; |
| } |
| } // namespace content |