OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "content/public/browser/zygote_handle_linux.h" | 5 #include "content/public/browser/zygote_handle_linux.h" |
6 | 6 |
7 #include "content/browser/zygote_host/zygote_communication_linux.h" | 7 #include "content/browser/zygote_host/zygote_communication_linux.h" |
8 | 8 |
9 namespace content { | 9 namespace content { |
10 namespace { | |
10 | 11 |
11 ZygoteHandle CreateZygote() { | 12 // 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
| |
12 ZygoteHandle zygote = new ZygoteCommunication(); | 13 ZygoteHandle g_generic_zygote = nullptr; |
13 zygote->Init(); | 14 |
14 return zygote; | 15 } // namespace |
16 | |
17 ZygoteHandle CreateGenericZygote() { | |
18 CHECK(!g_generic_zygote); | |
19 g_generic_zygote = new ZygoteCommunication(); | |
20 g_generic_zygote->Init(); | |
21 return g_generic_zygote; | |
15 } | 22 } |
16 | 23 |
17 ZygoteHandle* GetGenericZygote() { | 24 ZygoteHandle GetGenericZygote() { |
18 static ZygoteHandle zygote; | 25 CHECK(g_generic_zygote); |
19 return &zygote; | 26 return g_generic_zygote; |
20 } | 27 } |
21 | 28 |
22 } // namespace content | 29 } // namespace content |
OLD | NEW |