| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/callback_forward.h" | 6 #include "base/callback_forward.h" |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/native_library.h" | 8 #include "base/native_library.h" |
| 9 #include "base/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
| 10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 // Launch the app on its own thread. | 64 // Launch the app on its own thread. |
| 65 // TODO(beng): Create a unique thread name. | 65 // TODO(beng): Create a unique thread name. |
| 66 thread_.reset(new base::Thread("app_thread")); | 66 thread_.reset(new base::Thread("app_thread")); |
| 67 thread_->Start(); | 67 thread_->Start(); |
| 68 thread_->message_loop_proxy()->PostTaskAndReply( | 68 thread_->message_loop_proxy()->PostTaskAndReply( |
| 69 FROM_HERE, | 69 FROM_HERE, |
| 70 base::Bind(&LaunchAppOnThread, app_path, app_handle), | 70 base::Bind(&LaunchAppOnThread, app_path, app_handle), |
| 71 base::Bind(&AppContainer::AppCompleted, weak_factory_.GetWeakPtr())); | 71 base::Bind(&AppContainer::AppCompleted, weak_factory_.GetWeakPtr())); |
| 72 | 72 |
| 73 const char* hello_msg = "Hello"; | 73 const char* hello_msg = "Hello"; |
| 74 result = WriteMessage(shell_handle_, hello_msg, strlen(hello_msg)+1, | 74 result = WriteMessage(shell_handle_, hello_msg, |
| 75 static_cast<uint32_t>(strlen(hello_msg)+1), |
| 75 NULL, 0, MOJO_WRITE_MESSAGE_FLAG_NONE); | 76 NULL, 0, MOJO_WRITE_MESSAGE_FLAG_NONE); |
| 76 if (result < MOJO_RESULT_OK) { | 77 if (result < MOJO_RESULT_OK) { |
| 77 // Failure.. | 78 // Failure.. |
| 78 } | 79 } |
| 79 } | 80 } |
| 80 | 81 |
| 81 | 82 |
| 82 void AppContainer::AppCompleted() { | 83 void AppContainer::AppCompleted() { |
| 83 thread_.reset(); | 84 thread_.reset(); |
| 84 Close(shell_handle_); | 85 Close(shell_handle_); |
| 85 | 86 |
| 86 // Probably want to do something more sophisticated here, like notify someone | 87 // Probably want to do something more sophisticated here, like notify someone |
| 87 // else to do this. | 88 // else to do this. |
| 88 base::MessageLoop::current()->Quit(); | 89 base::MessageLoop::current()->Quit(); |
| 89 } | 90 } |
| 90 | 91 |
| 91 } // namespace shell | 92 } // namespace shell |
| 92 } // namespace mojo | 93 } // namespace mojo |
| OLD | NEW |