OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "mojo/shell/runner/host/child_process.h" | 5 #include "mojo/shell/runner/host/child_process.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 } | 228 } |
229 | 229 |
230 void OnConnectionError() { | 230 void OnConnectionError() { |
231 // A connection error means the connection to the shell is lost. This is not | 231 // A connection error means the connection to the shell is lost. This is not |
232 // recoverable. | 232 // recoverable. |
233 LOG(ERROR) << "Connection error to the shell."; | 233 LOG(ERROR) << "Connection error to the shell."; |
234 _exit(1); | 234 _exit(1); |
235 } | 235 } |
236 | 236 |
237 // |ChildController| methods: | 237 // |ChildController| methods: |
238 void StartApp(InterfaceRequest<mojom::Application> application_request, | 238 void StartApp(InterfaceRequest<mojom::ShellClient> request, |
239 const StartAppCallback& on_app_complete) override { | 239 const StartAppCallback& on_app_complete) override { |
240 DCHECK(thread_checker_.CalledOnValidThread()); | 240 DCHECK(thread_checker_.CalledOnValidThread()); |
241 | 241 |
242 on_app_complete_ = on_app_complete; | 242 on_app_complete_ = on_app_complete; |
243 unblocker_.Unblock(base::Bind(&ChildControllerImpl::StartAppOnMainThread, | 243 unblocker_.Unblock(base::Bind(&ChildControllerImpl::StartAppOnMainThread, |
244 base::Unretained(app_library_), | 244 base::Unretained(app_library_), |
245 base::Passed(&application_request))); | 245 base::Passed(&request))); |
246 } | 246 } |
247 | 247 |
248 void ExitNow(int32_t exit_code) override { | 248 void ExitNow(int32_t exit_code) override { |
249 DVLOG(2) << "ChildControllerImpl::ExitNow(" << exit_code << ")"; | 249 DVLOG(2) << "ChildControllerImpl::ExitNow(" << exit_code << ")"; |
250 _exit(exit_code); | 250 _exit(exit_code); |
251 } | 251 } |
252 | 252 |
253 private: | 253 private: |
254 ChildControllerImpl(AppContext* app_context, | 254 ChildControllerImpl(AppContext* app_context, |
255 base::NativeLibrary app_library, | 255 base::NativeLibrary app_library, |
256 const Blocker::Unblocker& unblocker) | 256 const Blocker::Unblocker& unblocker) |
257 : app_library_(app_library), unblocker_(unblocker), binding_(this) {} | 257 : app_library_(app_library), unblocker_(unblocker), binding_(this) {} |
258 | 258 |
259 static void StartAppOnMainThread( | 259 static void StartAppOnMainThread( |
260 base::NativeLibrary app_library, | 260 base::NativeLibrary app_library, |
261 InterfaceRequest<mojom::Application> application_request) { | 261 InterfaceRequest<mojom::ShellClient> request) { |
262 if (!RunNativeApplication(app_library, std::move(application_request))) { | 262 if (!RunNativeApplication(app_library, std::move(request))) { |
263 LOG(ERROR) << "Failure to RunNativeApplication()"; | 263 LOG(ERROR) << "Failure to RunNativeApplication()"; |
264 } | 264 } |
265 } | 265 } |
266 | 266 |
267 base::ThreadChecker thread_checker_; | 267 base::ThreadChecker thread_checker_; |
268 base::NativeLibrary app_library_; | 268 base::NativeLibrary app_library_; |
269 Blocker::Unblocker unblocker_; | 269 Blocker::Unblocker unblocker_; |
270 StartAppCallback on_app_complete_; | 270 StartAppCallback on_app_complete_; |
271 | 271 |
272 Binding<ChildController> binding_; | 272 Binding<ChildController> binding_; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 // This will block, then run whatever the controller wants. | 383 // This will block, then run whatever the controller wants. |
384 blocker.Block(); | 384 blocker.Block(); |
385 | 385 |
386 app_context.Shutdown(); | 386 app_context.Shutdown(); |
387 | 387 |
388 return 0; | 388 return 0; |
389 } | 389 } |
390 | 390 |
391 } // namespace shell | 391 } // namespace shell |
392 } // namespace mojo | 392 } // namespace mojo |
OLD | NEW |