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

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

Issue 23452016: Fix names of in-process threads, tidy gpu DEPS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: deps for webview Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « content/utility/in_process_utility_thread.h ('k') | content/utility/utility_main_thread.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/utility_main_thread.h" 5 #include "content/utility/in_process_utility_thread.h"
6 6
7 #include "content/child/child_process.h" 7 #include "content/child/child_process.h"
8 #include "content/utility/utility_thread_impl.h" 8 #include "content/utility/utility_thread_impl.h"
9 9
10 namespace content { 10 namespace content {
11 11
12 // We want to ensure there's only one utility thread running at a time, as there 12 // We want to ensure there's only one utility thread running at a time, as there
13 // are many globals used in the utility process. 13 // are many globals used in the utility process.
14 static base::LazyInstance<base::Lock> g_one_utility_thread_lock; 14 static base::LazyInstance<base::Lock> g_one_utility_thread_lock;
15 15
16 UtilityMainThread::UtilityMainThread(const std::string& channel_id) 16 InProcessUtilityThread::InProcessUtilityThread(const std::string& channel_id)
17 : Thread("Chrome_InProcUtilityThread"), channel_id_(channel_id) { 17 : Thread("Chrome_InProcUtilityThread"), channel_id_(channel_id) {
18 } 18 }
19 19
20 UtilityMainThread::~UtilityMainThread() { 20 InProcessUtilityThread::~InProcessUtilityThread() {
21 Stop(); 21 Stop();
22 } 22 }
23 23
24 void UtilityMainThread::Init() { 24 void InProcessUtilityThread::Init() {
25 // We need to return right away or else the main thread that started us will 25 // We need to return right away or else the main thread that started us will
26 // hang. 26 // hang.
27 base::MessageLoop::current()->PostTask( 27 base::MessageLoop::current()->PostTask(
28 FROM_HERE, 28 FROM_HERE,
29 base::Bind(&UtilityMainThread::InitInternal, base::Unretained(this))); 29 base::Bind(&InProcessUtilityThread::InitInternal,
30 base::Unretained(this)));
30 } 31 }
31 32
32 void UtilityMainThread::CleanUp() { 33 void InProcessUtilityThread::CleanUp() {
33 child_process_.reset(); 34 child_process_.reset();
34 35
35 // See comment in RendererMainThread. 36 // See comment in RendererMainThread.
36 SetThreadWasQuitProperly(true); 37 SetThreadWasQuitProperly(true);
37 g_one_utility_thread_lock.Get().Release(); 38 g_one_utility_thread_lock.Get().Release();
38 } 39 }
39 40
40 void UtilityMainThread::InitInternal() { 41 void InProcessUtilityThread::InitInternal() {
41 g_one_utility_thread_lock.Get().Acquire(); 42 g_one_utility_thread_lock.Get().Acquire();
42 child_process_.reset(new ChildProcess()); 43 child_process_.reset(new ChildProcess());
43 child_process_->set_main_thread(new UtilityThreadImpl(channel_id_)); 44 child_process_->set_main_thread(new UtilityThreadImpl(channel_id_));
44 } 45 }
45 46
46 base::Thread* CreateUtilityMainThread(const std::string& channel_id) { 47 base::Thread* CreateInProcessUtilityThread(const std::string& channel_id) {
47 return new UtilityMainThread(channel_id); 48 return new InProcessUtilityThread(channel_id);
48 } 49 }
49 50
50 } // namespace content 51 } // namespace content
OLDNEW
« no previous file with comments | « content/utility/in_process_utility_thread.h ('k') | content/utility/utility_main_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698