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

Side by Side Diff: content/browser/zygote_host/zygote_handle_linux.cc

Issue 2850903002: Clean up Linux zygote creation code (Closed)
Patch Set: Created 3 years, 7 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 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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698