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

Side by Side Diff: services/shell/background/background_shell.cc

Issue 2031693002: Migrate WaitableEvent to enum-based constructor in services/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@WEvent_enums
Patch Set: Created 4 years, 6 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
« no previous file with comments | « no previous file | services/shell/runner/host/child_process_base.cc » ('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 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 "services/shell/background/background_shell.h" 5 #include "services/shell/background/background_shell.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 thread_.reset(new MojoThread(std::move(init_params))); 144 thread_.reset(new MojoThread(std::move(init_params)));
145 thread_->Start(); 145 thread_->Start();
146 } 146 }
147 147
148 mojom::ShellClientRequest BackgroundShell::CreateShellClientRequest( 148 mojom::ShellClientRequest BackgroundShell::CreateShellClientRequest(
149 const std::string& name) { 149 const std::string& name) {
150 std::unique_ptr<ConnectParams> params(new ConnectParams); 150 std::unique_ptr<ConnectParams> params(new ConnectParams);
151 params->set_source(CreateShellIdentity()); 151 params->set_source(CreateShellIdentity());
152 params->set_target(Identity(name, mojom::kRootUserID)); 152 params->set_target(Identity(name, mojom::kRootUserID));
153 mojom::ShellClientRequest request; 153 mojom::ShellClientRequest request;
154 base::WaitableEvent signal(true, false); 154 base::WaitableEvent signal(base::WaitableEvent::ResetPolicy::MANUAL,
155 base::WaitableEvent::InitialState::NOT_SIGNALED);
155 thread_->message_loop()->task_runner()->PostTask( 156 thread_->message_loop()->task_runner()->PostTask(
156 FROM_HERE, base::Bind(&MojoThread::CreateShellClientRequest, 157 FROM_HERE, base::Bind(&MojoThread::CreateShellClientRequest,
157 base::Unretained(thread_.get()), &signal, name, 158 base::Unretained(thread_.get()), &signal, name,
158 &request)); 159 &request));
159 signal.Wait(); 160 signal.Wait();
160 thread_->message_loop()->task_runner()->PostTask( 161 thread_->message_loop()->task_runner()->PostTask(
161 FROM_HERE, base::Bind(&MojoThread::Connect, 162 FROM_HERE, base::Bind(&MojoThread::Connect,
162 base::Unretained(thread_.get()), 163 base::Unretained(thread_.get()),
163 base::Passed(&params))); 164 base::Passed(&params)));
164 return request; 165 return request;
165 } 166 }
166 167
167 void BackgroundShell::ExecuteOnShellThread( 168 void BackgroundShell::ExecuteOnShellThread(
168 const ShellThreadCallback& callback) { 169 const ShellThreadCallback& callback) {
169 thread_->message_loop()->task_runner()->PostTask( 170 thread_->message_loop()->task_runner()->PostTask(
170 FROM_HERE, base::Bind(&MojoThread::RunShellCallback, 171 FROM_HERE, base::Bind(&MojoThread::RunShellCallback,
171 base::Unretained(thread_.get()), callback)); 172 base::Unretained(thread_.get()), callback));
172 } 173 }
173 174
174 } // namespace shell 175 } // namespace shell
OLDNEW
« no previous file with comments | « no previous file | services/shell/runner/host/child_process_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698