OLD | NEW |
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 "mojo/public/cpp/application/run_application.h" | 5 #include "mojo/public/cpp/application/run_application.h" |
6 | 6 |
7 #include <assert.h> | 7 #include <assert.h> |
8 #include <pthread.h> | 8 #include <pthread.h> |
9 | 9 |
10 #include "mojo/public/cpp/application/application_impl_base.h" | 10 #include "mojo/public/cpp/application/application_impl_base.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 InitializeCurrentResultHolderIfNecessary(); | 54 InitializeCurrentResultHolderIfNecessary(); |
55 | 55 |
56 int error = pthread_setspecific(g_current_result_holder_key, result_holder); | 56 int error = pthread_setspecific(g_current_result_holder_key, result_holder); |
57 MOJO_ALLOW_UNUSED_LOCAL(error); | 57 MOJO_ALLOW_UNUSED_LOCAL(error); |
58 assert(!error); | 58 assert(!error); |
59 } | 59 } |
60 | 60 |
61 } // namespace | 61 } // namespace |
62 | 62 |
63 MojoResult RunMainApplication(MojoHandle application_request_handle, | 63 MojoResult RunMainApplication(MojoHandle application_request_handle, |
64 ApplicationImplBase* application_impl) { | 64 ApplicationImplBase* application_impl, |
65 return RunApplication(application_request_handle, application_impl); | 65 const RunApplicationOptions* options) { |
| 66 return RunApplication(application_request_handle, application_impl, options); |
66 } | 67 } |
67 | 68 |
68 MojoResult RunApplication(MojoHandle application_request_handle, | 69 MojoResult RunApplication(MojoHandle application_request_handle, |
69 ApplicationImplBase* application_impl) { | 70 ApplicationImplBase* application_impl, |
| 71 const RunApplicationOptions* options) { |
| 72 assert(!options); // No options supported! |
70 assert(!GetCurrentResultHolder()); | 73 assert(!GetCurrentResultHolder()); |
71 | 74 |
72 ResultHolder result_holder; | 75 ResultHolder result_holder; |
73 SetCurrentResultHolder(&result_holder); | 76 SetCurrentResultHolder(&result_holder); |
74 | 77 |
75 RunLoop loop; | 78 RunLoop loop; |
76 application_impl->Bind(InterfaceRequest<Application>( | 79 application_impl->Bind(InterfaceRequest<Application>( |
77 MakeScopedHandle(MessagePipeHandle(application_request_handle)))); | 80 MakeScopedHandle(MessagePipeHandle(application_request_handle)))); |
78 loop.Run(); | 81 loop.Run(); |
79 | 82 |
(...skipping 19 matching lines...) Expand all Loading... |
99 ResultHolder* result_holder = GetCurrentResultHolder(); | 102 ResultHolder* result_holder = GetCurrentResultHolder(); |
100 assert(result_holder); | 103 assert(result_holder); |
101 assert(!result_holder->is_set); | 104 assert(!result_holder->is_set); |
102 result_holder->result = result; | 105 result_holder->result = result; |
103 #ifndef NDEBUG | 106 #ifndef NDEBUG |
104 result_holder->is_set = true; | 107 result_holder->is_set = true; |
105 #endif | 108 #endif |
106 } | 109 } |
107 | 110 |
108 } // namespace mojo | 111 } // namespace mojo |
OLD | NEW |