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/out_of_process_dynamic_service_runner.h" | 5 #include "mojo/shell/out_of_process_dynamic_service_runner.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/scoped_native_library.h" | 11 #include "base/scoped_native_library.h" |
12 #include "mojo/public/cpp/bindings/allocation_scope.h" | |
13 | 12 |
14 namespace mojo { | 13 namespace mojo { |
15 namespace shell { | 14 namespace shell { |
16 | 15 |
17 OutOfProcessDynamicServiceRunner::OutOfProcessDynamicServiceRunner( | 16 OutOfProcessDynamicServiceRunner::OutOfProcessDynamicServiceRunner( |
18 Context* context) | 17 Context* context) |
19 : context_(context) { | 18 : context_(context) { |
20 } | 19 } |
21 | 20 |
22 OutOfProcessDynamicServiceRunner::~OutOfProcessDynamicServiceRunner() { | 21 OutOfProcessDynamicServiceRunner::~OutOfProcessDynamicServiceRunner() { |
(...skipping 14 matching lines...) Expand all Loading... |
37 | 36 |
38 DCHECK(!service_handle_.is_valid()); | 37 DCHECK(!service_handle_.is_valid()); |
39 service_handle_ = service_handle.Pass(); | 38 service_handle_ = service_handle.Pass(); |
40 | 39 |
41 DCHECK(app_completed_callback_.is_null()); | 40 DCHECK(app_completed_callback_.is_null()); |
42 app_completed_callback_ = app_completed_callback; | 41 app_completed_callback_ = app_completed_callback; |
43 | 42 |
44 app_child_process_host_.reset(new AppChildProcessHost(context_, this)); | 43 app_child_process_host_.reset(new AppChildProcessHost(context_, this)); |
45 app_child_process_host_->Start(); | 44 app_child_process_host_->Start(); |
46 | 45 |
47 // TODO(vtl): Where should my allocation scope be? | |
48 AllocationScope scope; | |
49 // TODO(vtl): |app_path.AsUTF8Unsafe()| is unsafe. | 46 // TODO(vtl): |app_path.AsUTF8Unsafe()| is unsafe. |
50 app_child_process_host_->controller()->StartApp( | 47 app_child_process_host_->controller()->StartApp( |
51 app_path.AsUTF8Unsafe(), | 48 String::From(app_path.AsUTF8Unsafe()), |
52 ScopedMessagePipeHandle(MessagePipeHandle( | 49 ScopedMessagePipeHandle(MessagePipeHandle( |
53 service_handle.release().value()))); | 50 service_handle.release().value()))); |
54 } | 51 } |
55 | 52 |
56 void OutOfProcessDynamicServiceRunner::AppCompleted(int32_t result) { | 53 void OutOfProcessDynamicServiceRunner::AppCompleted(int32_t result) { |
57 DVLOG(2) << "OutOfProcessDynamicServiceRunner::AppCompleted(" << result | 54 DVLOG(2) << "OutOfProcessDynamicServiceRunner::AppCompleted(" << result |
58 << ")"; | 55 << ")"; |
59 | 56 |
60 app_completed_callback_.Run(); | 57 app_completed_callback_.Run(); |
61 app_completed_callback_.Reset(); | 58 app_completed_callback_.Reset(); |
62 app_child_process_host_.reset(); | 59 app_child_process_host_.reset(); |
63 } | 60 } |
64 | 61 |
65 } // namespace shell | 62 } // namespace shell |
66 } // namespace mojo | 63 } // namespace mojo |
OLD | NEW |