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

Side by Side Diff: content/utility/in_process_utility_thread.cc

Issue 2733283002: Require explicit selection of traits for LazyInstance (Closed)
Patch Set: Created 3 years, 9 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/utility/in_process_utility_thread.h" 5 #include "content/utility/in_process_utility_thread.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
11 #include "content/child/child_process.h" 11 #include "content/child/child_process.h"
12 #include "content/utility/utility_thread_impl.h" 12 #include "content/utility/utility_thread_impl.h"
13 13
14 namespace content { 14 namespace content {
15 15
16 // We want to ensure there's only one utility thread running at a time, as there 16 // We want to ensure there's only one utility thread running at a time, as there
17 // are many globals used in the utility process. 17 // are many globals used in the utility process.
18 static base::LazyInstance<base::Lock> g_one_utility_thread_lock; 18 static base::LazyInstance<base::Lock>::DestructorAtExit
19 g_one_utility_thread_lock;
19 20
20 InProcessUtilityThread::InProcessUtilityThread( 21 InProcessUtilityThread::InProcessUtilityThread(
21 const InProcessChildThreadParams& params) 22 const InProcessChildThreadParams& params)
22 : Thread("Chrome_InProcUtilityThread"), params_(params) { 23 : Thread("Chrome_InProcUtilityThread"), params_(params) {
23 } 24 }
24 25
25 InProcessUtilityThread::~InProcessUtilityThread() { 26 InProcessUtilityThread::~InProcessUtilityThread() {
26 // Wait till in-process utility thread finishes clean up. 27 // Wait till in-process utility thread finishes clean up.
27 bool previous_value = base::ThreadRestrictions::SetIOAllowed(true); 28 bool previous_value = base::ThreadRestrictions::SetIOAllowed(true);
28 Stop(); 29 Stop();
(...skipping 21 matching lines...) Expand all
50 child_process_.reset(new ChildProcess()); 51 child_process_.reset(new ChildProcess());
51 child_process_->set_main_thread(new UtilityThreadImpl(params_)); 52 child_process_->set_main_thread(new UtilityThreadImpl(params_));
52 } 53 }
53 54
54 base::Thread* CreateInProcessUtilityThread( 55 base::Thread* CreateInProcessUtilityThread(
55 const InProcessChildThreadParams& params) { 56 const InProcessChildThreadParams& params) {
56 return new InProcessUtilityThread(params); 57 return new InProcessUtilityThread(params);
57 } 58 }
58 59
59 } // namespace content 60 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698