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

Side by Side Diff: content/child/child_process.cc

Issue 2116643002: Revert of Remove calls to MessageLoop::current() in content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/child/child_process.h" 5 #include "content/child/child_process.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "base/metrics/statistics_recorder.h" 11 #include "base/metrics/statistics_recorder.h"
12 #include "base/process/process_handle.h" 12 #include "base/process/process_handle.h"
13 #include "base/single_thread_task_runner.h"
14 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
15 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
16 #include "base/threading/thread.h" 15 #include "base/threading/thread.h"
17 #include "base/threading/thread_local.h" 16 #include "base/threading/thread_local.h"
18 #include "build/build_config.h" 17 #include "build/build_config.h"
19 #include "content/child/child_thread_impl.h" 18 #include "content/child/child_thread_impl.h"
20 19
21 #if defined(OS_ANDROID) 20 #if defined(OS_ANDROID)
22 #include "base/debug/debugger.h" 21 #include "base/debug/debugger.h"
23 #endif 22 #endif
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 ChildThreadImpl* ChildProcess::main_thread() { 80 ChildThreadImpl* ChildProcess::main_thread() {
82 return main_thread_.get(); 81 return main_thread_.get();
83 } 82 }
84 83
85 void ChildProcess::set_main_thread(ChildThreadImpl* thread) { 84 void ChildProcess::set_main_thread(ChildThreadImpl* thread) {
86 main_thread_.reset(thread); 85 main_thread_.reset(thread);
87 } 86 }
88 87
89 void ChildProcess::AddRefProcess() { 88 void ChildProcess::AddRefProcess() {
90 DCHECK(!main_thread_.get() || // null in unittests. 89 DCHECK(!main_thread_.get() || // null in unittests.
91 main_thread_->message_loop()->task_runner()->BelongsToCurrentThread()); 90 base::MessageLoop::current() == main_thread_->message_loop());
92 ref_count_++; 91 ref_count_++;
93 } 92 }
94 93
95 void ChildProcess::ReleaseProcess() { 94 void ChildProcess::ReleaseProcess() {
96 DCHECK(!main_thread_.get() || // null in unittests. 95 DCHECK(!main_thread_.get() || // null in unittests.
97 main_thread_->message_loop()->task_runner()->BelongsToCurrentThread()); 96 base::MessageLoop::current() == main_thread_->message_loop());
98 DCHECK(ref_count_); 97 DCHECK(ref_count_);
99 if (--ref_count_) 98 if (--ref_count_)
100 return; 99 return;
101 100
102 if (main_thread_) // null in unittests. 101 if (main_thread_) // null in unittests.
103 main_thread_->OnProcessFinalRelease(); 102 main_thread_->OnProcessFinalRelease();
104 } 103 }
105 104
106 ChildProcess* ChildProcess::current() { 105 ChildProcess* ChildProcess::current() {
107 return g_lazy_tls.Pointer()->Get(); 106 return g_lazy_tls.Pointer()->Get();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 memset(&sa, 0, sizeof(sa)); 144 memset(&sa, 0, sizeof(sa));
146 sa.sa_handler = SigUSR1Handler; 145 sa.sa_handler = SigUSR1Handler;
147 sigaction(SIGUSR1, &sa, NULL); 146 sigaction(SIGUSR1, &sa, NULL);
148 147
149 pause(); 148 pause();
150 #endif // defined(OS_ANDROID) 149 #endif // defined(OS_ANDROID)
151 #endif // defined(OS_POSIX) 150 #endif // defined(OS_POSIX)
152 } 151 }
153 152
154 } // namespace content 153 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/geolocation/geolocation_provider_impl_unittest.cc ('k') | content/child/child_thread_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698