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

Side by Side Diff: chrome/common/child_process_host.cc

Issue 27157: Initial checkin of the out of process worker implementation.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 | Annotate | Revision Log
« no previous file with comments | « chrome/chrome.sln ('k') | chrome/common/child_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 (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "chrome/common/child_process_host.h" 5 #include "chrome/common/child_process_host.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/singleton.h" 10 #include "base/singleton.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 host_->Notify(NotificationType::CHILD_PROCESS_HOST_CONNECTED); 147 host_->Notify(NotificationType::CHILD_PROCESS_HOST_CONNECTED);
148 } 148 }
149 149
150 void ChildProcessHost::ListenerHook::OnChannelError() { 150 void ChildProcessHost::ListenerHook::OnChannelError() {
151 host_->opening_channel_ = false; 151 host_->opening_channel_ = false;
152 host_->OnChannelError(); 152 host_->OnChannelError();
153 } 153 }
154 154
155 155
156 ChildProcessHost::Iterator::Iterator() : all_(true) { 156 ChildProcessHost::Iterator::Iterator() : all_(true) {
157 iterator_ = Singleton<ChildProcessList>::get()->begin();
158 DCHECK(MessageLoop::current() == 157 DCHECK(MessageLoop::current() ==
159 ChromeThread::GetMessageLoop(ChromeThread::IO)) << 158 ChromeThread::GetMessageLoop(ChromeThread::IO)) <<
160 "ChildProcessInfo::Iterator must be used on the IO thread."; 159 "ChildProcessInfo::Iterator must be used on the IO thread.";
160 iterator_ = Singleton<ChildProcessList>::get()->begin();
161 } 161 }
162 162
163 ChildProcessHost::Iterator::Iterator(ProcessType type) 163 ChildProcessHost::Iterator::Iterator(ProcessType type)
164 : all_(false), type_(type) { 164 : all_(false), type_(type) {
165 iterator_ = Singleton<ChildProcessList>::get()->begin();
166 DCHECK(MessageLoop::current() == 165 DCHECK(MessageLoop::current() ==
167 ChromeThread::GetMessageLoop(ChromeThread::IO)) << 166 ChromeThread::GetMessageLoop(ChromeThread::IO)) <<
168 "ChildProcessInfo::Iterator must be used on the IO thread."; 167 "ChildProcessInfo::Iterator must be used on the IO thread.";
168 iterator_ = Singleton<ChildProcessList>::get()->begin();
169 if (!Done() && (*iterator_)->type() != type_)
170 iterator_++;
169 } 171 }
170 172
171 ChildProcessInfo* ChildProcessHost::Iterator::operator++() { 173 ChildProcessInfo* ChildProcessHost::Iterator::operator++() {
172 do { 174 do {
173 ++iterator_; 175 ++iterator_;
174 if (Done()) 176 if (Done())
175 break; 177 break;
176 178
177 if (!all_ && (*iterator_)->type() != type_) 179 if (!all_ && (*iterator_)->type() != type_)
178 continue; 180 continue;
179 181
180 return *iterator_; 182 return *iterator_;
181 } while (true); 183 } while (true);
182 184
183 return NULL; 185 return NULL;
184 } 186 }
185 187
186 bool ChildProcessHost::Iterator::Done() { 188 bool ChildProcessHost::Iterator::Done() {
187 return iterator_ == Singleton<ChildProcessList>::get()->end(); 189 return iterator_ == Singleton<ChildProcessList>::get()->end();
188 } 190 }
OLDNEW
« no previous file with comments | « chrome/chrome.sln ('k') | chrome/common/child_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698