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

Unified Diff: examples/native_run_app/native_run_app.cc

Issue 1682113003: Mojo C++ bindings: Generate InterfaceHandle<> instead of InterfacePtr<>. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebase ontop of master, address trung's comments Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: examples/native_run_app/native_run_app.cc
diff --git a/examples/native_run_app/native_run_app.cc b/examples/native_run_app/native_run_app.cc
index 262d357f6c3311a95bc478934d2d8b3283b0b3ca..2cb92be050a149a9f9f7d7c651cdfa583588668b 100644
--- a/examples/native_run_app/native_run_app.cc
+++ b/examples/native_run_app/native_run_app.cc
@@ -16,6 +16,7 @@
#include <string.h>
#include <string>
+#include <utility>
#include <vector>
#include "base/logging.h"
@@ -46,9 +47,9 @@ mojo::Array<uint8_t> ToByteArray(const std::string& s) {
class TerminalConnection {
public:
- explicit TerminalConnection(mojo::files::FilePtr terminal,
+ explicit TerminalConnection(mojo::InterfaceHandle<mojo::files::File> terminal,
native_support::Process* native_support_process)
- : terminal_(terminal.Pass()),
+ : terminal_(mojo::files::FilePtr::Create(std::move(terminal))),
native_support_process_(native_support_process) {
terminal_.set_connection_error_handler([this]() { delete this; });
Start();
@@ -156,8 +157,9 @@ class TerminalConnection {
// TODO(vtl): If the |InterfacePtr| underlying |native_support_process_|
// encounters an error, then we're sort of dead in the water.
native_support_process_->SpawnWithTerminal(
- ToByteArray(command_line_[0]), argv.Pass(), nullptr, terminal_.Pass(),
- GetProxy(&process_controller_), [this](mojo::files::Error error) {
+ ToByteArray(command_line_[0]), argv.Pass(), nullptr,
+ terminal_.PassInterfaceHandle(), GetProxy(&process_controller_),
+ [this](mojo::files::Error error) {
this->DidSpawnWithTerminal(error);
});
process_controller_.set_connection_error_handler([this]() { delete this; });
@@ -201,10 +203,11 @@ class TerminalClientImpl : public TerminalClient {
~TerminalClientImpl() override {}
// |TerminalClient| implementation:
- void ConnectToTerminal(mojo::files::FilePtr terminal) override {
+ void ConnectToTerminal(
+ mojo::InterfaceHandle<mojo::files::File> terminal) override {
if (terminal) {
// Owns itself.
- new TerminalConnection(terminal.Pass(), native_support_process_);
+ new TerminalConnection(std::move(terminal), native_support_process_);
} else {
LOG(ERROR) << "No terminal";
}
« no previous file with comments | « examples/moterm_example_app/moterm_example_app.cc ('k') | examples/notification_generator/notification_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698