Mojo C++ bindings: Generate InterfaceHandle<> instead of InterfacePtr<>. This includes replacing all consumers of InterfacePtr<> (which were previously generated; mostly they are implementations of interfaces) with InterfaceHandle<>. This was a fairly mechanical process of replacing InterfacePtr with InterfaceHandle<>, and I've transformed one from the other at the earliest occurance. There are places where I could've delayed converting InterfaceHandle->InterfacePtr to a later point, but this entire job was very arduous. This CL needs to follow up with another doing the same thing, but in Flutter engine's services. BUG=#662 R=viettrungluu@chromium.org, jamesr@chromium.org Review URL: https://codereview.chromium.org/1682113003 .
diff --git a/apps/moterm/moterm_app.cc b/apps/moterm/moterm_app.cc index e8d2e2d..ab8abfa 100644 --- a/apps/moterm/moterm_app.cc +++ b/apps/moterm/moterm_app.cc
@@ -14,6 +14,6 @@ const std::string& connection_url, mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request, mojo::InterfaceRequest<mojo::ServiceProvider> services, - mojo::ServiceProviderPtr exposed_services) { + mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services) { new MotermView(app_impl(), view_owner_request.Pass(), services.Pass()); }
diff --git a/apps/moterm/moterm_app.h b/apps/moterm/moterm_app.h index 7ff9f68..be7d950 100644 --- a/apps/moterm/moterm_app.h +++ b/apps/moterm/moterm_app.h
@@ -17,7 +17,7 @@ const std::string& connection_url, mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request, mojo::InterfaceRequest<mojo::ServiceProvider> services, - mojo::ServiceProviderPtr exposed_services) override; + mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services) override; private: DISALLOW_COPY_AND_ASSIGN(MotermApp);
diff --git a/apps/moterm/moterm_view.cc b/apps/moterm/moterm_view.cc index 30b8e94..2c286e4 100644 --- a/apps/moterm/moterm_view.cc +++ b/apps/moterm/moterm_view.cc
@@ -13,6 +13,7 @@ #include <algorithm> #include <string> +#include <utility> #include "apps/moterm/key_util.h" #include "base/bind.h" @@ -162,7 +163,7 @@ } void MotermView::ConnectToClient( - mojo::terminal::TerminalClientPtr terminal_client, + mojo::InterfaceHandle<mojo::terminal::TerminalClient> terminal_client, bool force, const ConnectToClientCallback& callback) { if (driver_) { @@ -176,9 +177,10 @@ } } - mojo::files::FilePtr file; + mojo::InterfaceHandle<mojo::files::File> file; driver_ = MotermDriver::Create(this, GetProxy(&file)); - terminal_client->ConnectToTerminal(file.Pass()); + mojo::terminal::TerminalClientPtr::Create(std::move(terminal_client)) + ->ConnectToTerminal(std::move(file)); DCHECK(on_closed_callback_.is_null()); on_closed_callback_ = [callback] { callback.Run(mojo::files::Error::OK); }; }
diff --git a/apps/moterm/moterm_view.h b/apps/moterm/moterm_view.h index 06c319b..8907cc7 100644 --- a/apps/moterm/moterm_view.h +++ b/apps/moterm/moterm_view.h
@@ -70,9 +70,10 @@ void Connect(mojo::InterfaceRequest<mojo::files::File> terminal_file, bool force, const ConnectCallback& callback) override; - void ConnectToClient(mojo::terminal::TerminalClientPtr terminal_client, - bool force, - const ConnectToClientCallback& callback) override; + void ConnectToClient( + mojo::InterfaceHandle<mojo::terminal::TerminalClient> terminal_client, + bool force, + const ConnectToClientCallback& callback) override; void GetSize(const GetSizeCallback& callback) override; void SetSize(uint32_t rows, uint32_t columns,
diff --git a/examples/content_handler_demo/content_handler_demo.cc b/examples/content_handler_demo/content_handler_demo.cc index aa6012d..fe885d9 100644 --- a/examples/content_handler_demo/content_handler_demo.cc +++ b/examples/content_handler_demo/content_handler_demo.cc
@@ -5,6 +5,7 @@ #include <stdio.h> #include <memory> +#include <utility> #include "mojo/public/c/system/main.h" #include "mojo/public/cpp/application/application_delegate.h" @@ -23,16 +24,16 @@ ScopedDataPipeConsumerHandle body) : binding_(this, request.Pass()), body_(body.Pass()) {} - void Initialize(ShellPtr shell, + void Initialize(InterfaceHandle<Shell> shell, Array<String> args, const mojo::String& url) override { - shell_ = shell.Pass(); + shell_ = ShellPtr::Create(std::move(shell)); } void RequestQuit() override {} void AcceptConnection(const String& requestor_url, InterfaceRequest<ServiceProvider> services, - ServiceProviderPtr exported_services, + InterfaceHandle<ServiceProvider> exported_services, const String& url) override { printf( "ContentHandler::OnConnect - url:%s - requestor_url:%s - body " @@ -110,7 +111,6 @@ } private: - MOJO_DISALLOW_COPY_AND_ASSIGN(ContentHandlerApp); };
diff --git a/examples/echo_terminal/main.cc b/examples/echo_terminal/main.cc index ef6b40e..f4a0ec1 100644 --- a/examples/echo_terminal/main.cc +++ b/examples/echo_terminal/main.cc
@@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <utility> + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/logging.h" @@ -118,10 +120,12 @@ } // |mojo::terminal::TerminalClient| implementation: - void ConnectToTerminal(mojo::files::FilePtr terminal) override { + void ConnectToTerminal( + mojo::InterfaceHandle<mojo::files::File> terminal) override { DCHECK(terminal); // The |TerminalEchoer| will own itself. - (new TerminalEchoer(terminal.Pass()))->StartReading(); + (new TerminalEchoer(mojo::files::FilePtr::Create(std::move(terminal)))) + ->StartReading(); } mojo::BindingSet<mojo::terminal::TerminalClient> terminal_clients_;
diff --git a/examples/forwarding_content_handler/forwarding_content_handler.cc b/examples/forwarding_content_handler/forwarding_content_handler.cc index 045132e..25b0269 100644 --- a/examples/forwarding_content_handler/forwarding_content_handler.cc +++ b/examples/forwarding_content_handler/forwarding_content_handler.cc
@@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <utility> + #include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "mojo/application/application_runner_chromium.h" @@ -29,14 +31,14 @@ private: // Application: - void Initialize(ShellPtr shell, + void Initialize(InterfaceHandle<Shell> shell, Array<String> args, const mojo::String& url) override { - shell_ = shell.Pass(); + shell_ = ShellPtr::Create(std::move(shell)); } void AcceptConnection(const String& requestor_url, InterfaceRequest<ServiceProvider> services, - ServiceProviderPtr exposed_services, + InterfaceHandle<ServiceProvider> exposed_services, const String& requested_url) override { shell_->ConnectToApplication(target_url_, services.Pass(), exposed_services.Pass()); @@ -69,7 +71,7 @@ CHECK(!response.is_null()); const std::string requestor_url(response->url); std::string target_url; - if(!common::BlockingCopyToString(response->body.Pass(), &target_url)) { + if (!common::BlockingCopyToString(response->body.Pass(), &target_url)) { LOG(WARNING) << "unable to read target URL from " << requestor_url; return nullptr; }
diff --git a/examples/indirect_service/indirect_integer_service.cc b/examples/indirect_service/indirect_integer_service.cc index e4239a9..072e9e0 100644 --- a/examples/indirect_service/indirect_integer_service.cc +++ b/examples/indirect_service/indirect_integer_service.cc
@@ -29,8 +29,8 @@ // IndirectIntegerService - void Set(IntegerServicePtr service) override { - integer_service_ = service.Pass(); + void Set(InterfaceHandle<IntegerService> service) override { + integer_service_ = IntegerServicePtr::Create(std::move(service)); } void Get(InterfaceRequest<IntegerService> service) override {
diff --git a/examples/indirect_service/indirect_service_demo.cc b/examples/indirect_service/indirect_service_demo.cc index 4fdfb4f..2c9d72a 100644 --- a/examples/indirect_service/indirect_service_demo.cc +++ b/examples/indirect_service/indirect_service_demo.cc
@@ -97,7 +97,8 @@ app->ConnectToService("mojo:indirect_integer_service", &indirect_integer_service_); app->ConnectToService("mojo:integer_service", &indirect_service_delegate); - indirect_integer_service_->Set(indirect_service_delegate.Pass()); + indirect_integer_service_->Set( + indirect_service_delegate.PassInterfaceHandle()); for (unsigned i = 0; i < kTaskCount; i++) { IntegerServicePtr integer_service;
diff --git a/examples/moterm_example_app/moterm_example_app.cc b/examples/moterm_example_app/moterm_example_app.cc index e6364fc..8e4c32d 100644 --- a/examples/moterm_example_app/moterm_example_app.cc +++ b/examples/moterm_example_app/moterm_example_app.cc
@@ -8,6 +8,7 @@ #include <string.h> #include <algorithm> +#include <utility> #include "base/bind.h" #include "base/macros.h" @@ -132,7 +133,7 @@ mojo::terminal::TerminalClientPtr dest_terminal_client; mojo::ConnectToService(dest_sp.get(), &dest_terminal_client); moterm_terminal_->ConnectToClient( - dest_terminal_client.Pass(), true, + std::move(dest_terminal_client), true, base::Bind(&MotermExampleAppView::OnDestinationDone, weak_factory_.GetWeakPtr())); } @@ -165,7 +166,7 @@ const std::string& connection_url, mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request, mojo::InterfaceRequest<mojo::ServiceProvider> services, - mojo::ServiceProviderPtr exposed_services) override { + mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services) override { new MotermExampleAppView(app_impl()->shell(), view_owner_request.Pass()); }
diff --git a/examples/native_run_app/native_run_app.cc b/examples/native_run_app/native_run_app.cc index 262d357..2cb92be 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 @@ 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 @@ // 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 @@ ~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"; }
diff --git a/examples/notification_generator/notification_generator.cc b/examples/notification_generator/notification_generator.cc index 0d7f755..9d182b4 100644 --- a/examples/notification_generator/notification_generator.cc +++ b/examples/notification_generator/notification_generator.cc
@@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <utility> + #include "base/bind.h" #include "base/macros.h" #include "mojo/application/application_runner_chromium.h" @@ -59,11 +61,12 @@ void PostNotification(const char* title, const char* text, notifications::NotificationPtr* notification) { - notifications::NotificationClientPtr notification_client; + mojo::InterfaceHandle<notifications::NotificationClient> + notification_client; auto request = mojo::GetProxy(¬ification_client); client_bindings_.AddBinding(this, request.Pass()); notification_service_->Post(CreateNotificationData(title, text).Pass(), - notification_client.Pass(), + std::move(notification_client), GetProxy(notification)); }
diff --git a/examples/spinning_cube/gles2_client_impl.cc b/examples/spinning_cube/gles2_client_impl.cc index 7cbcc49..7ba8ca0 100644 --- a/examples/spinning_cube/gles2_client_impl.cc +++ b/examples/spinning_cube/gles2_client_impl.cc
@@ -11,6 +11,7 @@ #include <math.h> #include <stdlib.h> #include <cmath> +#include <utility> #include "mojo/public/c/gpu/MGL/mgl.h" #include "mojo/public/c/gpu/MGL/mgl_onscreen.h" @@ -56,10 +57,11 @@ waiting_to_draw_(false), context_provider_(context_provider.Pass()), context_(nullptr) { - context_provider_->Create(nullptr, - [this](mojo::CommandBufferPtr command_buffer) { - ContextCreated(command_buffer.Pass()); - }); + context_provider_->Create( + nullptr, + [this](mojo::InterfaceHandle<mojo::CommandBuffer> command_buffer) { + ContextCreated(std::move(command_buffer)); + }); } GLES2ClientImpl::~GLES2ClientImpl() { @@ -132,12 +134,12 @@ } } -void GLES2ClientImpl::ContextCreated(mojo::CommandBufferPtr command_buffer) { - context_ = MGLCreateContext( - MGL_API_VERSION_GLES2, - command_buffer.PassInterfaceHandle().PassHandle().release().value(), - MGL_NO_CONTEXT, &ContextLostThunk, this, - mojo::Environment::GetDefaultAsyncWaiter()); +void GLES2ClientImpl::ContextCreated( + mojo::InterfaceHandle<mojo::CommandBuffer> command_buffer) { + context_ = MGLCreateContext(MGL_API_VERSION_GLES2, + command_buffer.PassHandle().release().value(), + MGL_NO_CONTEXT, &ContextLostThunk, this, + mojo::Environment::GetDefaultAsyncWaiter()); MGLMakeCurrent(context_); cube_.Init(); WantToDraw(); @@ -147,10 +149,11 @@ cube_.OnGLContextLost(); MGLDestroyContext(context_); context_ = nullptr; - context_provider_->Create(nullptr, - [this](mojo::CommandBufferPtr command_buffer) { - ContextCreated(command_buffer.Pass()); - }); + context_provider_->Create( + nullptr, + [this](mojo::InterfaceHandle<mojo::CommandBuffer> command_buffer) { + ContextCreated(std::move(command_buffer)); + }); } void GLES2ClientImpl::ContextLostThunk(void* closure) {
diff --git a/examples/spinning_cube/gles2_client_impl.h b/examples/spinning_cube/gles2_client_impl.h index 4ba6600..03325fa 100644 --- a/examples/spinning_cube/gles2_client_impl.h +++ b/examples/spinning_cube/gles2_client_impl.h
@@ -22,7 +22,8 @@ void Draw(); private: - void ContextCreated(mojo::CommandBufferPtr command_buffer); + void ContextCreated( + mojo::InterfaceHandle<mojo::CommandBuffer> command_buffer); void ContextLost(); static void ContextLostThunk(void* closure); void WantToDraw();
diff --git a/examples/spinning_cube/spinning_cube_app.cc b/examples/spinning_cube/spinning_cube_app.cc index f90f9d1..15b208a 100644 --- a/examples/spinning_cube/spinning_cube_app.cc +++ b/examples/spinning_cube/spinning_cube_app.cc
@@ -5,6 +5,7 @@ #include <assert.h> #include <memory> +#include <utility> #include "base/bind.h" #include "base/memory/scoped_ptr.h" @@ -75,9 +76,9 @@ private: void SetEventDispatcher() { - mojo::NativeViewportEventDispatcherPtr ptr; + mojo::InterfaceHandle<mojo::NativeViewportEventDispatcher> ptr; dispatcher_binding_.Bind(GetProxy(&ptr)); - viewport_->SetEventDispatcher(ptr.Pass()); + viewport_->SetEventDispatcher(std::move(ptr)); } void OnViewportConnectionError() { mojo::RunLoop::current()->Quit(); }
diff --git a/examples/ui/noodles/noodles_app.cc b/examples/ui/noodles/noodles_app.cc index 4a6543d..c790822 100644 --- a/examples/ui/noodles/noodles_app.cc +++ b/examples/ui/noodles/noodles_app.cc
@@ -16,7 +16,7 @@ const std::string& connection_url, mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request, mojo::InterfaceRequest<mojo::ServiceProvider> services, - mojo::ServiceProviderPtr exposed_services) { + mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services) { new NoodlesView(app_impl(), view_owner_request.Pass()); }
diff --git a/examples/ui/noodles/noodles_app.h b/examples/ui/noodles/noodles_app.h index 6556b2b..e30e659 100644 --- a/examples/ui/noodles/noodles_app.h +++ b/examples/ui/noodles/noodles_app.h
@@ -18,7 +18,7 @@ const std::string& connection_url, mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request, mojo::InterfaceRequest<mojo::ServiceProvider> services, - mojo::ServiceProviderPtr exposed_services) override; + mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services) override; private: DISALLOW_COPY_AND_ASSIGN(NoodlesApp);
diff --git a/examples/ui/pdf_viewer/pdf_viewer.cc b/examples/ui/pdf_viewer/pdf_viewer.cc index ce5c605..3833dba 100644 --- a/examples/ui/pdf_viewer/pdf_viewer.cc +++ b/examples/ui/pdf_viewer/pdf_viewer.cc
@@ -260,7 +260,7 @@ const std::string& connection_url, mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request, mojo::InterfaceRequest<mojo::ServiceProvider> services, - mojo::ServiceProviderPtr exposed_services) override { + mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services) override { new PDFDocumentView(app_impl(), view_owner_request.Pass(), pdf_document_); }
diff --git a/examples/ui/png_viewer/png_viewer.cc b/examples/ui/png_viewer/png_viewer.cc index 16265e4..f733b7c 100644 --- a/examples/ui/png_viewer/png_viewer.cc +++ b/examples/ui/png_viewer/png_viewer.cc
@@ -110,7 +110,7 @@ const std::string& connection_url, mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request, mojo::InterfaceRequest<mojo::ServiceProvider> services, - mojo::ServiceProviderPtr exposed_services) override { + mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services) override { new PNGView(app_impl(), view_owner_request.Pass(), image_); }
diff --git a/examples/ui/shapes/shapes_app.cc b/examples/ui/shapes/shapes_app.cc index 917c274..84643a0 100644 --- a/examples/ui/shapes/shapes_app.cc +++ b/examples/ui/shapes/shapes_app.cc
@@ -16,7 +16,7 @@ const std::string& connection_url, mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request, mojo::InterfaceRequest<mojo::ServiceProvider> services, - mojo::ServiceProviderPtr exposed_services) { + mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services) { new ShapesView(app_impl(), view_owner_request.Pass()); }
diff --git a/examples/ui/shapes/shapes_app.h b/examples/ui/shapes/shapes_app.h index d44c2d7..5ec93bf 100644 --- a/examples/ui/shapes/shapes_app.h +++ b/examples/ui/shapes/shapes_app.h
@@ -18,7 +18,7 @@ const std::string& connection_url, mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request, mojo::InterfaceRequest<mojo::ServiceProvider> services, - mojo::ServiceProviderPtr exposed_services) override; + mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services) override; private: DISALLOW_COPY_AND_ASSIGN(ShapesApp);
diff --git a/examples/ui/spinning_cube/spinning_cube_app.cc b/examples/ui/spinning_cube/spinning_cube_app.cc index 8c1d797..2fbe9d4 100644 --- a/examples/ui/spinning_cube/spinning_cube_app.cc +++ b/examples/ui/spinning_cube/spinning_cube_app.cc
@@ -16,7 +16,7 @@ const std::string& connection_url, mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request, mojo::InterfaceRequest<mojo::ServiceProvider> services, - mojo::ServiceProviderPtr exposed_services) { + mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services) { new SpinningCubeView(app_impl(), view_owner_request.Pass()); }
diff --git a/examples/ui/spinning_cube/spinning_cube_app.h b/examples/ui/spinning_cube/spinning_cube_app.h index 5aa3f5f..b6e7a78 100644 --- a/examples/ui/spinning_cube/spinning_cube_app.h +++ b/examples/ui/spinning_cube/spinning_cube_app.h
@@ -18,7 +18,7 @@ const std::string& connection_url, mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request, mojo::InterfaceRequest<mojo::ServiceProvider> services, - mojo::ServiceProviderPtr exposed_services) override; + mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services) override; private: DISALLOW_COPY_AND_ASSIGN(SpinningCubeApp);
diff --git a/examples/ui/tile/tile_app.cc b/examples/ui/tile/tile_app.cc index fcec7c6..23f1b30 100644 --- a/examples/ui/tile/tile_app.cc +++ b/examples/ui/tile/tile_app.cc
@@ -19,7 +19,7 @@ const std::string& connection_url, mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request, mojo::InterfaceRequest<mojo::ServiceProvider> services, - mojo::ServiceProviderPtr exposed_services) { + mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services) { GURL url(connection_url); std::vector<std::string> view_urls; base::SplitString(url.query(), ',', &view_urls);
diff --git a/examples/ui/tile/tile_app.h b/examples/ui/tile/tile_app.h index 35ba767..05060c6 100644 --- a/examples/ui/tile/tile_app.h +++ b/examples/ui/tile/tile_app.h
@@ -18,7 +18,7 @@ const std::string& connection_url, mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request, mojo::InterfaceRequest<mojo::ServiceProvider> services, - mojo::ServiceProviderPtr exposed_services) override; + mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services) override; private: DISALLOW_COPY_AND_ASSIGN(TileApp);
diff --git a/mojo/common/trace_provider_impl.cc b/mojo/common/trace_provider_impl.cc index 1e61f62..cda6b61 100644 --- a/mojo/common/trace_provider_impl.cc +++ b/mojo/common/trace_provider_impl.cc
@@ -4,6 +4,8 @@ #include "mojo/common/trace_provider_impl.h" +#include <utility> + #include "base/callback.h" #include "base/logging.h" #include "base/memory/weak_ptr.h" @@ -28,10 +30,11 @@ } } -void TraceProviderImpl::StartTracing(const String& categories, - tracing::TraceRecorderPtr recorder) { +void TraceProviderImpl::StartTracing( + const String& categories, + mojo::InterfaceHandle<tracing::TraceRecorder> recorder) { DCHECK(!recorder_.get()); - recorder_ = recorder.Pass(); + recorder_ = tracing::TraceRecorderPtr::Create(std::move(recorder)); tracing_forced_ = false; if (!base::trace_event::TraceLog::GetInstance()->IsEnabled()) { std::string categories_str = categories.To<std::string>();
diff --git a/mojo/common/trace_provider_impl.h b/mojo/common/trace_provider_impl.h index a1864ff..217ec7a 100644 --- a/mojo/common/trace_provider_impl.h +++ b/mojo/common/trace_provider_impl.h
@@ -26,8 +26,9 @@ private: // tracing::TraceProvider implementation: - void StartTracing(const String& categories, - tracing::TraceRecorderPtr recorder) override; + void StartTracing( + const String& categories, + mojo::InterfaceHandle<tracing::TraceRecorder> recorder) override; void StopTracing() override; void SendChunk(const scoped_refptr<base::RefCountedString>& events_str,
diff --git a/mojo/gles2/command_buffer_client_impl.cc b/mojo/gles2/command_buffer_client_impl.cc index bda36a6..769d81a 100644 --- a/mojo/gles2/command_buffer_client_impl.cc +++ b/mojo/gles2/command_buffer_client_impl.cc
@@ -5,6 +5,7 @@ #include "mojo/gles2/command_buffer_client_impl.h" #include <limits> +#include <utility> #include "base/logging.h" #include "base/process/process_handle.h" @@ -47,7 +48,7 @@ class CommandBufferClientImpl::SyncClientImpl : public mojo::CommandBufferSyncClient { public: - SyncClientImpl(mojo::CommandBufferSyncClientPtr* ptr, + SyncClientImpl(mojo::InterfaceHandle<mojo::CommandBufferSyncClient>* ptr, const MojoAsyncWaiter* async_waiter) : initialized_successfully_(false), binding_(this, ptr, async_waiter) {} @@ -89,8 +90,9 @@ class CommandBufferClientImpl::SyncPointClientImpl : public mojo::CommandBufferSyncPointClient { public: - SyncPointClientImpl(mojo::CommandBufferSyncPointClientPtr* ptr, - const MojoAsyncWaiter* async_waiter) + SyncPointClientImpl( + mojo::InterfaceHandle<mojo::CommandBufferSyncPointClient>* ptr, + const MojoAsyncWaiter* async_waiter) : sync_point_(0u), binding_(this, ptr, async_waiter) {} uint32_t WaitForInsertSyncPoint() { @@ -143,19 +145,18 @@ shared_state()->Initialize(); - mojo::CommandBufferSyncClientPtr sync_client; + mojo::InterfaceHandle<mojo::CommandBufferSyncClient> sync_client; sync_client_impl_.reset(new SyncClientImpl(&sync_client, async_waiter_)); - mojo::CommandBufferSyncPointClientPtr sync_point_client; + mojo::InterfaceHandle<mojo::CommandBufferSyncPointClient> sync_point_client; sync_point_client_impl_.reset( new SyncPointClientImpl(&sync_point_client, async_waiter_)); - mojo::CommandBufferLostContextObserverPtr observer_ptr; + mojo::InterfaceHandle<mojo::CommandBufferLostContextObserver> observer_ptr; observer_binding_.Bind(GetProxy(&observer_ptr), async_waiter_); - command_buffer_->Initialize(sync_client.Pass(), - sync_point_client.Pass(), - observer_ptr.Pass(), - duped.Pass()); + command_buffer_->Initialize(std::move(sync_client), + std::move(sync_point_client), + std::move(observer_ptr), duped.Pass()); // Wait for DidInitialize to come on the sync client pipe. if (!sync_client_impl_->WaitForInitialization()) {
diff --git a/mojo/gpu/gl_context.cc b/mojo/gpu/gl_context.cc index ec7afa5..4f14595 100644 --- a/mojo/gpu/gl_context.cc +++ b/mojo/gpu/gl_context.cc
@@ -12,12 +12,12 @@ GLContext::Observer::~Observer() {} -GLContext::GLContext(CommandBufferPtr command_buffer) : weak_factory_(this) { - context_ = MGLCreateContext( - MGL_API_VERSION_GLES2, - command_buffer.PassInterfaceHandle().PassHandle().release().value(), - MGL_NO_CONTEXT, &ContextLostThunk, this, - Environment::GetDefaultAsyncWaiter()); +GLContext::GLContext(InterfaceHandle<CommandBuffer> command_buffer) + : weak_factory_(this) { + context_ = MGLCreateContext(MGL_API_VERSION_GLES2, + command_buffer.PassHandle().release().value(), + MGL_NO_CONTEXT, &ContextLostThunk, this, + Environment::GetDefaultAsyncWaiter()); DCHECK(context_ != MGL_NO_CONTEXT); } @@ -32,13 +32,13 @@ GetProxy(&native_viewport), nullptr); GpuPtr gpu_service; ConnectToService(native_viewport.get(), &gpu_service); - CommandBufferPtr command_buffer; + InterfaceHandle<CommandBuffer> command_buffer; gpu_service->CreateOffscreenGLES2Context(GetProxy(&command_buffer)); return CreateFromCommandBuffer(command_buffer.Pass()); } base::WeakPtr<GLContext> GLContext::CreateFromCommandBuffer( - CommandBufferPtr command_buffer) { + InterfaceHandle<CommandBuffer> command_buffer) { return (new GLContext(command_buffer.Pass()))->weak_factory_.GetWeakPtr(); }
diff --git a/mojo/gpu/gl_context.h b/mojo/gpu/gl_context.h index a557fdb..8b0de9b 100644 --- a/mojo/gpu/gl_context.h +++ b/mojo/gpu/gl_context.h
@@ -33,7 +33,7 @@ // Creates a GL context from a command buffer. static base::WeakPtr<GLContext> CreateFromCommandBuffer( - CommandBufferPtr command_buffer); + InterfaceHandle<CommandBuffer> command_buffer); void MakeCurrent(); bool IsCurrent(); @@ -43,7 +43,7 @@ void RemoveObserver(Observer* observer); private: - explicit GLContext(CommandBufferPtr command_buffer); + explicit GLContext(InterfaceHandle<CommandBuffer> command_buffer); ~GLContext(); static void ContextLostThunk(void* self);
diff --git a/mojo/public/cpp/application/application_impl.h b/mojo/public/cpp/application/application_impl.h index b084006..acbde1f 100644 --- a/mojo/public/cpp/application/application_impl.h +++ b/mojo/public/cpp/application/application_impl.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef MOJO_PUBLIC_APPLICATION_APPLICATION_IMPL_H_ -#define MOJO_PUBLIC_APPLICATION_APPLICATION_IMPL_H_ +#ifndef MOJO_PUBLIC_CPP_APPLICATION_APPLICATION_IMPL_H_ +#define MOJO_PUBLIC_CPP_APPLICATION_APPLICATION_IMPL_H_ #include <memory> #include <string> @@ -91,12 +91,12 @@ ShellPtr* shell); // |Application| implementation. - void Initialize(ShellPtr shell, + void Initialize(InterfaceHandle<Shell> shell, Array<String> args, const mojo::String& url) override; void AcceptConnection(const String& requestor_url, InterfaceRequest<ServiceProvider> services, - ServiceProviderPtr exposed_services, + InterfaceHandle<ServiceProvider> exposed_services, const String& url) override; void RequestQuit() override; @@ -116,4 +116,4 @@ } // namespace mojo -#endif // MOJO_PUBLIC_APPLICATION_APPLICATION_IMPL_H_ +#endif // MOJO_PUBLIC_CPP_APPLICATION_APPLICATION_IMPL_H_
diff --git a/mojo/public/cpp/application/connect.h b/mojo/public/cpp/application/connect.h index 06b79e7..16efc2d 100644 --- a/mojo/public/cpp/application/connect.h +++ b/mojo/public/cpp/application/connect.h
@@ -11,6 +11,10 @@ namespace mojo { +// TODO(vardhan): Replaces uses of ConnectToService(.., InterfacePtr<>) with the +// ConnectToService(.., InterfaceHandle<>) alternative instead, and get +// rid of following 3 functions. + // Binds |ptr| to a remote implementation of Interface from |service_provider|. template <typename Interface> inline void ConnectToService(ServiceProvider* service_provider, @@ -26,8 +30,8 @@ const std::string& application_url, InterfacePtr<Interface>* ptr) { ServiceProviderPtr service_provider; - shell->ConnectToApplication(application_url, - GetProxy(&service_provider), nullptr); + shell->ConnectToApplication(application_url, GetProxy(&service_provider), + nullptr); ConnectToService(service_provider.get(), ptr); } @@ -42,6 +46,37 @@ ConnectToService(service_provider.get(), ptr); } +// Binds |ptr| to a remote implementation of Interface from |service_provider|. +template <typename Interface> +inline void ConnectToService(ServiceProvider* service_provider, + InterfaceHandle<Interface>* ptr) { + MessagePipe pipe; + *ptr = InterfaceHandle<Interface>(pipe.handle0.Pass(), 0u); + service_provider->ConnectToService(Interface::Name_, pipe.handle1.Pass()); +} + +// Binds |ptr| to a remote implementation of Interface from |application_url|. +template <typename Interface> +inline void ConnectToService(Shell* shell, + const std::string& application_url, + InterfaceHandle<Interface>* ptr) { + ServiceProviderPtr service_provider; + shell->ConnectToApplication(application_url, GetProxy(&service_provider), + nullptr); + ConnectToService(service_provider.get(), ptr); +} + +// Binds |ptr| to a remote implementation of Interface from |application_url|. +template <typename Interface> +inline void ConnectToService(ApplicationConnector* application_connector, + const std::string& application_url, + InterfaceHandle<Interface>* ptr) { + ServiceProviderPtr service_provider; + application_connector->ConnectToApplication( + application_url, GetProxy(&service_provider), nullptr); + ConnectToService(service_provider.get(), ptr); +} + } // namespace mojo #endif // MOJO_PUBLIC_CPP_APPLICATION_CONNECT_H_
diff --git a/mojo/public/cpp/application/lib/application_impl.cc b/mojo/public/cpp/application/lib/application_impl.cc index 569bca0..1bdbf6b 100644 --- a/mojo/public/cpp/application/lib/application_impl.cc +++ b/mojo/public/cpp/application/lib/application_impl.cc
@@ -37,11 +37,11 @@ ApplicationConnection* ApplicationImpl::ConnectToApplication( const String& application_url) { MOJO_CHECK(shell_); - ServiceProviderPtr local_services; + InterfaceHandle<ServiceProvider> local_services; InterfaceRequest<ServiceProvider> local_request = GetProxy(&local_services); ServiceProviderPtr remote_services; shell_->ConnectToApplication(application_url, GetProxy(&remote_services), - local_services.Pass()); + std::move(local_services)); internal::ServiceRegistry* registry = new internal::ServiceRegistry( this, application_url, application_url, remote_services.Pass(), local_request.Pass()); @@ -61,10 +61,10 @@ shell->Bind(shell_.PassInterfaceHandle()); } -void ApplicationImpl::Initialize(ShellPtr shell, +void ApplicationImpl::Initialize(InterfaceHandle<Shell> shell, Array<String> args, const mojo::String& url) { - shell_ = shell.Pass(); + shell_ = ShellPtr::Create(std::move(shell)); shell_.set_connection_error_handler([this]() { delegate_->Quit(); incoming_service_registries_.clear(); @@ -79,11 +79,12 @@ void ApplicationImpl::AcceptConnection( const String& requestor_url, InterfaceRequest<ServiceProvider> services, - ServiceProviderPtr exposed_services, + InterfaceHandle<ServiceProvider> exposed_services, const String& url) { std::unique_ptr<internal::ServiceRegistry> registry( new internal::ServiceRegistry(this, url, requestor_url, - exposed_services.Pass(), services.Pass())); + std::move(exposed_services), + services.Pass())); if (!delegate_->ConfigureIncomingConnection(registry.get())) return; incoming_service_registries_.push_back(std::move(registry));
diff --git a/mojo/public/cpp/application/lib/application_test_base.cc b/mojo/public/cpp/application/lib/application_test_base.cc index 8547e57..0c57925 100644 --- a/mojo/public/cpp/application/lib/application_test_base.cc +++ b/mojo/public/cpp/application/lib/application_test_base.cc
@@ -4,6 +4,8 @@ #include "mojo/public/cpp/application/application_test_base.h" +#include <utility> + #include "mojo/public/cpp/application/application_impl.h" #include "mojo/public/cpp/bindings/binding.h" #include "mojo/public/cpp/environment/environment.h" @@ -50,18 +52,18 @@ private: // Application implementation. - void Initialize(ShellPtr shell, + void Initialize(InterfaceHandle<Shell> shell, Array<String> args, const mojo::String& url) override { *args_ = args.Pass(); g_url = url; g_application_request = binding_.Unbind(); - g_shell = shell.Pass(); + g_shell = ShellPtr::Create(std::move(shell)); } void AcceptConnection(const String& requestor_url, InterfaceRequest<ServiceProvider> services, - ServiceProviderPtr exposed_services, + InterfaceHandle<ServiceProvider> exposed_services, const String& url) override { MOJO_CHECK(false); }
diff --git a/mojo/public/cpp/application/lib/service_registry.cc b/mojo/public/cpp/application/lib/service_registry.cc index 5b7c93e..dea138d 100644 --- a/mojo/public/cpp/application/lib/service_registry.cc +++ b/mojo/public/cpp/application/lib/service_registry.cc
@@ -15,13 +15,14 @@ ApplicationImpl* application_impl, const std::string& connection_url, const std::string& remote_url, - ServiceProviderPtr remote_services, + InterfaceHandle<ServiceProvider> remote_services, InterfaceRequest<ServiceProvider> local_services) : application_impl_(application_impl), connection_url_(connection_url), remote_url_(remote_url), local_binding_(this), - remote_service_provider_(remote_services.Pass()) { + remote_service_provider_( + ServiceProviderPtr::Create(std::move(remote_services))) { if (local_services.is_pending()) local_binding_.Bind(local_services.Pass()); }
diff --git a/mojo/public/cpp/application/lib/service_registry.h b/mojo/public/cpp/application/lib/service_registry.h index de98774..975fc21 100644 --- a/mojo/public/cpp/application/lib/service_registry.h +++ b/mojo/public/cpp/application/lib/service_registry.h
@@ -28,7 +28,7 @@ ServiceRegistry(ApplicationImpl* application_impl, const std::string& connection_url, const std::string& remote_url, - ServiceProviderPtr remote_services, + InterfaceHandle<ServiceProvider> remote_services, InterfaceRequest<ServiceProvider> local_services); ~ServiceRegistry() override;
diff --git a/mojo/public/cpp/bindings/binding.h b/mojo/public/cpp/bindings/binding.h index d556f0b..61630c7 100644 --- a/mojo/public/cpp/bindings/binding.h +++ b/mojo/public/cpp/bindings/binding.h
@@ -82,6 +82,8 @@ // of the parameters. |impl| must outlive the binding. |ptr| only needs to // last until the constructor returns. See class comment for definition of // |waiter|. + // TODO(vardhan): Deprecate this in favor of the |InterfaceHandle<>| overload + // below. Binding(Interface* impl, InterfacePtr<Interface>* ptr, const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) @@ -89,6 +91,19 @@ Bind(ptr, waiter); } + // Constructs a completed binding of |impl| to a new message pipe, passing the + // client end to |ptr|, which takes ownership of it. The caller is expected to + // pass |ptr| on to the client of the service. Does not take ownership of any + // of the parameters. |impl| must outlive the binding. |ptr| only needs to + // last until the constructor returns. See class comment for definition of + // |waiter|. + Binding(Interface* impl, + InterfaceHandle<Interface>* interface_handle, + const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) + : Binding(impl) { + Bind(interface_handle, waiter); + } + // Constructs a completed binding of |impl| to the message pipe endpoint in // |request|, taking ownership of the endpoint. Does not take ownership of // |impl|, which must outlive the binding. See class comment for definition of @@ -131,6 +146,8 @@ // takes ownership of it. The caller is expected to pass |ptr| on to the // eventual client of the service. Does not take ownership of |ptr|. See // class comment for definition of |waiter|. + // TODO(vardhan): Deprecate this in favor of the |InterfaceHandle<>| overload + // below. void Bind( InterfacePtr<Interface>* ptr, const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) { @@ -142,6 +159,21 @@ } // Completes a binding that was constructed with only an interface + // implementation by creating a new message pipe, binding one end of it to the + // previously specified implementation, and passing the other to |ptr|, which + // takes ownership of it. The caller is expected to pass |ptr| on to the + // eventual client of the service. Does not take ownership of |ptr|. See + // class comment for definition of |waiter|. + void Bind( + InterfaceHandle<Interface>* interface_handle, + const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) { + MessagePipe pipe; + *interface_handle = + InterfaceHandle<Interface>(pipe.handle0.Pass(), Interface::Version_); + Bind(pipe.handle1.Pass(), waiter); + } + + // Completes a binding that was constructed with only an interface // implementation by removing the message pipe endpoint from |request| and // binding it to the previously specified implementation. See class comment // for definition of |waiter|.
diff --git a/mojo/public/cpp/bindings/interface_handle.h b/mojo/public/cpp/bindings/interface_handle.h index e03fad5..9bb7746 100644 --- a/mojo/public/cpp/bindings/interface_handle.h +++ b/mojo/public/cpp/bindings/interface_handle.h
@@ -5,17 +5,23 @@ #ifndef MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_INFO_H_ #define MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_INFO_H_ +#include <cstddef> + #include "mojo/public/cpp/system/macros.h" #include "mojo/public/cpp/system/message_pipe.h" namespace mojo { +template <typename Interface> +class InterfacePtr; + // InterfaceHandle stores necessary information to communicate with a remote // interface implementation, which could be used to construct an InterfacePtr. template <typename Interface> class InterfaceHandle { public: InterfaceHandle() : version_(0u) {} + InterfaceHandle(std::nullptr_t) : version_(0u) {} InterfaceHandle(ScopedMessagePipeHandle handle, uint32_t version) : handle_(handle.Pass()), version_(version) {} @@ -25,6 +31,14 @@ other.version_ = 0u; } + // Making this constructor templated ensures that it is not type-instantiated + // unless it is used, making the InterfacePtr<->InterfaceHandle codependency + // less fragile. + template <typename SameInterfaceAsAbove = Interface> + InterfaceHandle(InterfacePtr<SameInterfaceAsAbove>&& ptr) { + *this = ptr.PassInterfaceHandle(); + } + ~InterfaceHandle() {} InterfaceHandle& operator=(InterfaceHandle&& other) { @@ -37,6 +51,8 @@ return *this; } + // Tests as true if we have a valid handle. + explicit operator bool() const { return is_valid(); } bool is_valid() const { return handle_.is_valid(); } ScopedMessagePipeHandle PassHandle() { return handle_.Pass(); }
diff --git a/mojo/public/cpp/bindings/interface_request.h b/mojo/public/cpp/bindings/interface_request.h index 515fe88..0d634a2 100644 --- a/mojo/public/cpp/bindings/interface_request.h +++ b/mojo/public/cpp/bindings/interface_request.h
@@ -122,6 +122,17 @@ return MakeRequest<Interface>(pipe.handle1.Pass()); } +// This is an overload of GetProxy() that assumes that the client end of the +// handle is an InterfaceHandle<>. It creates a new message pipe over which the +// Interface is to be served. InterfaceHandle<> represents the client's end, +// and InterfaceRequest<> should be used to bind to an implementation. +template <typename Interface> +InterfaceRequest<Interface> GetProxy(InterfaceHandle<Interface>* ptr) { + MessagePipe pipe; + *ptr = InterfaceHandle<Interface>(pipe.handle0.Pass(), 0u); + return MakeRequest<Interface>(pipe.handle1.Pass()); +} + } // namespace mojo #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_REQUEST_H_
diff --git a/mojo/public/cpp/bindings/lib/array_serialization.h b/mojo/public/cpp/bindings/lib/array_serialization.h index 035f27c..3ffaf03 100644 --- a/mojo/public/cpp/bindings/lib/array_serialization.h +++ b/mojo/public/cpp/bindings/lib/array_serialization.h
@@ -240,10 +240,11 @@ } }; -// Serializes and deserializes arrays of interfaces (interface pointers). +// Serializes and deserializes arrays of interfaces (interface handles). template <typename Interface> -struct ArraySerializer<InterfacePtr<Interface>, Interface_Data, false> { - static size_t GetSerializedSize(const Array<InterfacePtr<Interface>>& input) { +struct ArraySerializer<InterfaceHandle<Interface>, Interface_Data, false> { + static size_t GetSerializedSize( + const Array<InterfaceHandle<Interface>>& input) { return sizeof(Array_Data<Interface_Data>) + Align(input.size() * sizeof(Interface_Data)); } @@ -260,7 +261,7 @@ for (size_t i = 0; i < num_elements; ++i, ++it) { // Transfer ownership of the handle. - internal::InterfacePointerToData(it->Pass(), &output->at(i)); + internal::InterfaceHandleToData(it->Pass(), &output->at(i)); if (!validate_params->element_is_nullable && !output->at(i).handle.is_valid()) { MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( @@ -276,10 +277,10 @@ } static void DeserializeElements(Array_Data<Interface_Data>* input, - Array<InterfacePtr<Interface>>* output) { - auto result = Array<InterfacePtr<Interface>>::New(input->size()); + Array<InterfaceHandle<Interface>>* output) { + auto result = Array<InterfaceHandle<Interface>>::New(input->size()); for (size_t i = 0; i < input->size(); ++i) - internal::InterfaceDataToPointer(&input->at(i), &result.at(i)); + internal::InterfaceDataToHandle(&input->at(i), &result.at(i)); output->Swap(&result); } };
diff --git a/mojo/public/cpp/bindings/lib/bindings_internal.h b/mojo/public/cpp/bindings/lib/bindings_internal.h index 17fc012..bef3d7e 100644 --- a/mojo/public/cpp/bindings/lib/bindings_internal.h +++ b/mojo/public/cpp/bindings/lib/bindings_internal.h
@@ -18,7 +18,7 @@ class Array; template <typename Interface> -class InterfacePtr; +class InterfaceHandle; template <typename Interface> class InterfaceRequest; @@ -212,7 +212,7 @@ using DataType = MessagePipeHandle; }; template <typename Interface> -struct WrapperTraits<InterfacePtr<Interface>, true, false> { +struct WrapperTraits<InterfaceHandle<Interface>, true, false> { using DataType = Interface_Data; }; // Unions. @@ -253,12 +253,12 @@ } }; -// |InterfacePtr|s hold message pipes uniquely, so they can only be equal if +// |InterfaceHandle|s hold message pipes uniquely, so they can only be equal if // they're the same object or are both "invalid". template <typename I> -struct ValueTraits<InterfacePtr<I>> { - static bool Equals(const InterfacePtr<I>& a, const InterfacePtr<I>& b) { - return (&a == &b) || (!a.is_bound() && !b.is_bound()); +struct ValueTraits<InterfaceHandle<I>> { + static bool Equals(const InterfaceHandle<I>& a, const InterfaceHandle<I>& b) { + return (&a == &b) || (!a.is_valid() && !b.is_valid()); } };
diff --git a/mojo/public/cpp/bindings/lib/bindings_serialization.h b/mojo/public/cpp/bindings/lib/bindings_serialization.h index 9b0f70b..94f17bf 100644 --- a/mojo/public/cpp/bindings/lib/bindings_serialization.h +++ b/mojo/public/cpp/bindings/lib/bindings_serialization.h
@@ -13,9 +13,6 @@ namespace mojo { template <typename I> -class InterfacePtr; - -template <typename I> class InterfaceHandle; namespace internal { @@ -77,18 +74,17 @@ } template <typename T> -inline void InterfacePointerToData(InterfacePtr<T> input, - Interface_Data* output) { - InterfaceHandle<T> info = input.PassInterfaceHandle(); - output->handle = info.PassHandle().release(); - output->version = info.version(); +inline void InterfaceHandleToData(InterfaceHandle<T> input, + Interface_Data* output) { + output->handle = input.PassHandle().release(); + output->version = input.version(); } template <typename T> -inline void InterfaceDataToPointer(Interface_Data* input, - InterfacePtr<T>* output) { - output->Bind(InterfaceHandle<T>( - MakeScopedHandle(FetchAndReset(&input->handle)), input->version)); +inline void InterfaceDataToHandle(Interface_Data* input, + InterfaceHandle<T>* output) { + *output = InterfaceHandle<T>(MakeScopedHandle(FetchAndReset(&input->handle)), + input->version); } } // namespace internal
diff --git a/mojo/public/cpp/bindings/strong_binding.h b/mojo/public/cpp/bindings/strong_binding.h index e38c7ff..59097a1 100644 --- a/mojo/public/cpp/bindings/strong_binding.h +++ b/mojo/public/cpp/bindings/strong_binding.h
@@ -75,6 +75,8 @@ // of the parameters. |impl| must outlive the binding. |ptr| only needs to // last until the constructor returns. See class comment for definition of // |waiter|. + // TODO(vardhan): Deprecate this in favor of the |InterfaceHandle<>| overload + // below. StrongBinding( Interface* impl, InterfacePtr<Interface>* ptr, @@ -83,6 +85,20 @@ binding_.Bind(ptr, waiter); } + // Constructs a completed binding of |impl| to a new message pipe, passing the + // client end to |ptr|, which takes ownership of it. The caller is expected to + // pass |ptr| on to the client of the service. Does not take ownership of any + // of the parameters. |impl| must outlive the binding. |ptr| only needs to + // last until the constructor returns. See class comment for definition of + // |waiter|. + StrongBinding( + Interface* impl, + InterfaceHandle<Interface>* ptr, + const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) + : StrongBinding(impl) { + binding_.Bind(ptr, waiter); + } + // Constructs a completed binding of |impl| to the message pipe endpoint in // |request|, taking ownership of the endpoint. Does not take ownership of // |impl|, which must outlive the binding. See class comment for definition of @@ -115,6 +131,8 @@ // takes ownership of it. The caller is expected to pass |ptr| on to the // eventual client of the service. Does not take ownership of |ptr|. See // class comment for definition of |waiter|. + // TODO(vardhan): Deprecate this in favor of the |InterfaceHandle<>| overload + // below. void Bind( InterfacePtr<Interface>* ptr, const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) { @@ -123,6 +141,19 @@ } // Completes a binding that was constructed with only an interface + // implementation by creating a new message pipe, binding one end of it to the + // previously specified implementation, and passing the other to |ptr|, which + // takes ownership of it. The caller is expected to pass |ptr| on to the + // eventual client of the service. Does not take ownership of |ptr|. See + // class comment for definition of |waiter|. + void Bind( + InterfaceHandle<Interface>* ptr, + const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) { + assert(!binding_.is_bound()); + binding_.Bind(ptr, waiter); + } + + // Completes a binding that was constructed with only an interface // implementation by removing the message pipe endpoint from |request| and // binding it to the previously specified implementation. See class comment // for definition of |waiter|.
diff --git a/mojo/public/cpp/bindings/tests/array_unittest.cc b/mojo/public/cpp/bindings/tests/array_unittest.cc index 3891780..e81b5ee 100644 --- a/mojo/public/cpp/bindings/tests/array_unittest.cc +++ b/mojo/public/cpp/bindings/tests/array_unittest.cc
@@ -395,7 +395,7 @@ // Test serializing and deserializing an Array<InterfacePtr>. TEST_F(ArrayTest, Serialization_ArrayOfInterfacePtr) { - auto iface_array = Array<TestInterfacePtr>::New(1); + auto iface_array = Array<mojo::InterfaceHandle<TestInterface>>::New(1); size_t size = GetSerializedSize_(iface_array); EXPECT_EQ(8U // array header + (8U * 1), // Interface_Data * number of elements @@ -409,28 +409,28 @@ EXPECT_EQ( mojo::internal::ValidationError::UNEXPECTED_INVALID_HANDLE, SerializeArray_(&iface_array, &buf, &output, &validate_non_nullable)); - EXPECT_FALSE(iface_array[0].is_bound()); + EXPECT_FALSE(iface_array[0].is_valid()); // 2. Invalid InterfacePtr should pass if array elements are nullable. ArrayValidateParams validate_nullable(1, true, nullptr); EXPECT_EQ(mojo::internal::ValidationError::NONE, SerializeArray_(&iface_array, &buf, &output, &validate_nullable)); - EXPECT_FALSE(iface_array[0].is_bound()); + EXPECT_FALSE(iface_array[0].is_valid()); // 3. Should serialize successfully if InterfacePtr is valid. TestInterfacePtr iface_ptr; auto iface_req = GetProxy(&iface_ptr); iface_array[0] = iface_ptr.Pass(); - EXPECT_TRUE(iface_array[0].is_bound()); + EXPECT_TRUE(iface_array[0].is_valid()); EXPECT_EQ( mojo::internal::ValidationError::NONE, SerializeArray_(&iface_array, &buf, &output, &validate_non_nullable)); - EXPECT_FALSE(iface_array[0].is_bound()); + EXPECT_FALSE(iface_array[0].is_valid()); Deserialize_(output, &iface_array); - EXPECT_TRUE(iface_array[0].is_bound()); + EXPECT_TRUE(iface_array[0].is_valid()); } // Test serializing and deserializing a struct with an Array<> of another struct @@ -468,14 +468,14 @@ iface_struct->iptr = iface_ptr.Pass(); struct_arr_iface.structs_array[0] = iface_struct.Pass(); - ASSERT_TRUE(struct_arr_iface.structs_array[0]->iptr.is_bound()); + ASSERT_TRUE(struct_arr_iface.structs_array[0]->iptr.is_valid()); EXPECT_EQ(mojo::internal::ValidationError::NONE, Serialize_(&struct_arr_iface, &buf, &struct_arr_iface_data)); - EXPECT_FALSE(struct_arr_iface.structs_array[0]->iptr.is_bound()); + EXPECT_FALSE(struct_arr_iface.structs_array[0]->iptr.is_valid()); Deserialize_(struct_arr_iface_data, &struct_arr_iface); - EXPECT_TRUE(struct_arr_iface.structs_array[0]->iptr.is_bound()); + EXPECT_TRUE(struct_arr_iface.structs_array[0]->iptr.is_valid()); } // Test serializing and deserializing a struct with an Array<> of interface
diff --git a/mojo/public/cpp/bindings/tests/binding_unittest.cc b/mojo/public/cpp/bindings/tests/binding_unittest.cc index b8d4cf4..491a9fa 100644 --- a/mojo/public/cpp/bindings/tests/binding_unittest.cc +++ b/mojo/public/cpp/bindings/tests/binding_unittest.cc
@@ -44,7 +44,7 @@ // sample::Service implementation void Frobinate(sample::FooPtr foo, BazOptions options, - sample::PortPtr port, + mojo::InterfaceHandle<sample::Port> port, const FrobinateCallback& callback) override { callback.Run(1); } @@ -336,4 +336,4 @@ } } // namespace -} // mojo +} // namespace mojo
diff --git a/mojo/public/cpp/bindings/tests/handle_passing_unittest.cc b/mojo/public/cpp/bindings/tests/handle_passing_unittest.cc index 5345cca..3af49e4 100644 --- a/mojo/public/cpp/bindings/tests/handle_passing_unittest.cc +++ b/mojo/public/cpp/bindings/tests/handle_passing_unittest.cc
@@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <utility> + #include "mojo/public/cpp/bindings/binding.h" #include "mojo/public/cpp/bindings/strong_binding.h" #include "mojo/public/cpp/environment/environment.h" @@ -89,7 +91,8 @@ callback.Run(response.Pass(), text1); if (request->obj) - request->obj->DoSomething(); + imported::ImportedInterfacePtr::Create(std::move(request->obj)) + ->DoSomething(); } void DoStuff2(ScopedDataPipeConsumerHandle pipe, @@ -126,9 +129,9 @@ const mojo::Callback<void(InterfaceRequest<imported::ImportedInterface>)>& callback) override {} void TakeImportedInterface( - imported::ImportedInterfacePtr imported, - const mojo::Callback<void(imported::ImportedInterfacePtr)>& callback) - override {} + InterfaceHandle<imported::ImportedInterface> imported, + const mojo::Callback<void(InterfaceHandle<imported::ImportedInterface>)>& + callback) override {} private: ScopedMessagePipeHandle pipe1_;
diff --git a/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc b/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc index e0a21c7..dc8e290 100644 --- a/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc +++ b/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc
@@ -153,7 +153,7 @@ void Frobinate(sample::FooPtr foo, sample::Service::BazOptions baz, - sample::PortPtr port, + mojo::InterfaceHandle<sample::Port> port, const sample::Service::FrobinateCallback& callback) override { max_call_depth_ = std::max(++call_depth_, max_call_depth_); if (call_depth_ == 1) {
diff --git a/mojo/public/cpp/bindings/tests/sample_service_unittest.cc b/mojo/public/cpp/bindings/tests/sample_service_unittest.cc index c291b1c..2ef710b 100644 --- a/mojo/public/cpp/bindings/tests/sample_service_unittest.cc +++ b/mojo/public/cpp/bindings/tests/sample_service_unittest.cc
@@ -5,6 +5,7 @@ #include <algorithm> #include <ostream> #include <string> +#include <utility> #include "mojo/public/cpp/environment/environment.h" #include "mojo/public/cpp/system/macros.h" @@ -258,7 +259,7 @@ public: void Frobinate(FooPtr foo, BazOptions baz, - PortPtr port, + mojo::InterfaceHandle<Port> port, const Service::FrobinateCallback& callback) override { // Users code goes here to handle the incoming Frobinate message. @@ -274,7 +275,8 @@ int depth = 1; Print(depth, "foo", foo); Print(depth, "baz", static_cast<int32_t>(baz)); - Print(depth, "port", port.get()); + auto portptr = PortPtr::Create(std::move(port)); + Print(depth, "port", portptr.get()); } callback.Run(5); } @@ -340,7 +342,7 @@ CheckFoo(*foo); PortPtr port; - service->Frobinate(foo.Pass(), Service::BazOptions::EXTRA, port.Pass(), + service->Frobinate(foo.Pass(), Service::BazOptions::EXTRA, std::move(port), Service::FrobinateCallback()); delete service;
diff --git a/mojo/public/cpp/bindings/tests/union_unittest.cc b/mojo/public/cpp/bindings/tests/union_unittest.cc index 312c9c0..95a2d7f 100644 --- a/mojo/public/cpp/bindings/tests/union_unittest.cc +++ b/mojo/public/cpp/bindings/tests/union_unittest.cc
@@ -2,7 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <utility> #include <vector> + #include "mojo/public/cpp/bindings/array.h" #include "mojo/public/cpp/bindings/binding.h" #include "mojo/public/cpp/bindings/lib/array_internal.h" @@ -1224,7 +1226,9 @@ HandleUnionPtr handle(HandleUnion::New()); handle->set_f_small_cache(ptr.Pass()); - handle->get_f_small_cache()->SetIntValue(10); + auto small_cache = + SmallCachePtr::Create(std::move(handle->get_f_small_cache())); + small_cache->SetIntValue(10); run_loop.RunUntilIdle(); EXPECT_EQ(10, impl.int_value()); } @@ -1253,7 +1257,9 @@ HandleUnionPtr handle2(HandleUnion::New()); Deserialize_(data, handle2.get()); - handle2->get_f_small_cache()->SetIntValue(10); + auto small_cache = + SmallCachePtr::Create(std::move(handle2->get_f_small_cache())); + small_cache->SetIntValue(10); run_loop.RunUntilIdle(); EXPECT_EQ(10, impl.int_value()); }
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl index 94b6745..6b1a75d 100644 --- a/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl +++ b/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl
@@ -43,7 +43,6 @@ {% for interface in interfaces %} class {{interface.name}}; using {{interface.name}}Ptr = mojo::InterfacePtr<{{interface.name}}>; -using {{interface.name}}Handle = mojo::InterfaceHandle<{{interface.name}}>; {% endfor %} {#--- Struct Forward Declarations -#}
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/struct_macros.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/struct_macros.tmpl index 645229f..c0b79e6 100644 --- a/mojo/public/tools/bindings/generators/cpp_templates/struct_macros.tmpl +++ b/mojo/public/tools/bindings/generators/cpp_templates/struct_macros.tmpl
@@ -181,7 +181,8 @@ {%- endif %} {%- elif kind|is_any_handle_kind or kind|is_interface_kind %} {%- if kind|is_interface_kind %} - mojo::internal::InterfacePointerToData({{input_field}}.Pass(), &{{output}}->{{name}}); + mojo::internal::InterfaceHandleToData({{input_field}}.Pass(), + &{{output}}->{{name}}); {%- elif kind|is_interface_request_kind %} {{output}}->{{name}} = {{input_field}}.PassMessagePipe().release(); {%- else %} @@ -253,7 +254,7 @@ Deserialize_({{input}}->{{name}}.ptr, &{{output_field}}); {%- endif %} {%- elif kind|is_interface_kind %} - mojo::internal::InterfaceDataToPointer(&{{input}}->{{name}}, &{{output_field}}); + mojo::internal::InterfaceDataToHandle(&{{input}}->{{name}}, &{{output_field}}); {%- elif kind|is_interface_request_kind %} {{output_field}}.Bind(mojo::MakeScopedHandle(mojo::internal::FetchAndReset(&{{input}}->{{name}}))); {%- elif kind|is_any_handle_kind %}
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/union_serialization_definition.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/union_serialization_definition.tmpl index fde27aa..532a8f8 100644 --- a/mojo/public/tools/bindings/generators/cpp_templates/union_serialization_definition.tmpl +++ b/mojo/public/tools/bindings/generators/cpp_templates/union_serialization_definition.tmpl
@@ -91,7 +91,7 @@ mojo::internal::Interface_Data* {{field.name}} = reinterpret_cast<mojo::internal::Interface_Data*>( &result->data.f_{{field.name}}); - mojo::internal::InterfacePointerToData( + mojo::internal::InterfaceHandleToData( input_acc.data()->{{field.name}}->Pass(), {{field.name}}); {% elif field.kind|is_enum_kind %} result->data.f_{{field.name}} = @@ -144,7 +144,7 @@ mojo::internal::Interface_Data* {{field.name}}_in = reinterpret_cast<mojo::internal::Interface_Data*>( &input->data.f_{{field.name}}); - mojo::internal::InterfaceDataToPointer( + mojo::internal::InterfaceDataToHandle( {{field.name}}_in, &{{field.name}}_out); output->set_{{field.name}}({{field.name}}_out.Pass()); {% elif field.kind|is_enum_kind %}
diff --git a/mojo/public/tools/bindings/generators/mojom_cpp_generator.py b/mojo/public/tools/bindings/generators/mojom_cpp_generator.py index 6ff277a..38488cf 100644 --- a/mojo/public/tools/bindings/generators/mojom_cpp_generator.py +++ b/mojo/public/tools/bindings/generators/mojom_cpp_generator.py
@@ -142,7 +142,7 @@ return "mojo::Map<%s, %s>" % (GetCppArrayArgWrapperType(kind.key_kind), GetCppArrayArgWrapperType(kind.value_kind)) if mojom.IsInterfaceKind(kind): - return "%sPtr" % GetNameForKind(kind) + return "mojo::InterfaceHandle<%s>" % GetNameForKind(kind) if mojom.IsInterfaceRequestKind(kind): return "mojo::InterfaceRequest<%s>" % GetNameForKind(kind.kind) if mojom.IsStringKind(kind): @@ -170,7 +170,7 @@ return "mojo::Map<%s, %s>" % (GetCppArrayArgWrapperType(kind.key_kind), GetCppArrayArgWrapperType(kind.value_kind)) if mojom.IsInterfaceKind(kind): - return "%sPtr" % GetNameForKind(kind) + return "mojo::InterfaceHandle<%s>" % GetNameForKind(kind) if mojom.IsInterfaceRequestKind(kind): return "mojo::InterfaceRequest<%s>" % GetNameForKind(kind.kind) if mojom.IsStringKind(kind): @@ -196,7 +196,7 @@ return "mojo::Map<%s, %s>" % (GetCppArrayArgWrapperType(kind.key_kind), GetCppArrayArgWrapperType(kind.value_kind)) if mojom.IsInterfaceKind(kind): - return "%sPtr" % GetNameForKind(kind) + return "mojo::InterfaceHandle<%s>" % GetNameForKind(kind) if mojom.IsInterfaceRequestKind(kind): return "mojo::InterfaceRequest<%s>" % GetNameForKind(kind.kind) if mojom.IsEnumKind(kind):
diff --git a/mojo/ui/gl_renderer_unittest.cc b/mojo/ui/gl_renderer_unittest.cc index 82c3191..71b806c 100644 --- a/mojo/ui/gl_renderer_unittest.cc +++ b/mojo/ui/gl_renderer_unittest.cc
@@ -13,6 +13,8 @@ #include "mojo/ui/gl_renderer.h" #include "testing/gtest/include/gtest/gtest.h" +using mojo::gfx::composition::MailboxTextureCallbackPtr; + namespace { static const base::TimeDelta kDefaultMessageDelay = @@ -66,7 +68,7 @@ EXPECT_FALSE(resource->get_mailbox_texture()->mailbox_name.is_null()); EXPECT_TRUE(resource->get_mailbox_texture()->size->Equals(size)); EXPECT_NE(resource->get_mailbox_texture()->sync_point, 0u); - EXPECT_NE(resource->get_mailbox_texture()->callback.get(), nullptr); + EXPECT_TRUE(resource->get_mailbox_texture()->callback.is_valid()); } TEST_F(GLRendererTest, GetTextureTwiceSameSize) { @@ -91,7 +93,7 @@ EXPECT_FALSE(resource1->get_mailbox_texture()->mailbox_name.is_null()); EXPECT_TRUE(resource1->get_mailbox_texture()->size->Equals(size)); EXPECT_NE(resource1->get_mailbox_texture()->sync_point, 0u); - EXPECT_NE(resource1->get_mailbox_texture()->callback.get(), nullptr); + EXPECT_TRUE(resource1->get_mailbox_texture()->callback.is_valid()); mojo::gfx::composition::ResourcePtr resource2 = renderer.BindTextureResource(std::move(texture2)); @@ -100,7 +102,7 @@ EXPECT_FALSE(resource2->get_mailbox_texture()->mailbox_name.is_null()); EXPECT_TRUE(resource2->get_mailbox_texture()->size->Equals(size)); EXPECT_NE(resource2->get_mailbox_texture()->sync_point, 0u); - EXPECT_NE(resource2->get_mailbox_texture()->callback.get(), nullptr); + EXPECT_TRUE(resource2->get_mailbox_texture()->callback.is_valid()); EXPECT_NE(resource2->get_mailbox_texture()->sync_point, resource1->get_mailbox_texture()->sync_point); @@ -120,7 +122,9 @@ mojo::gfx::composition::ResourcePtr resource1 = renderer.BindTextureResource(std::move(texture1)); EXPECT_NE(resource1.get(), nullptr); - resource1->get_mailbox_texture()->callback->OnMailboxTextureReleased(); + MailboxTextureCallbackPtr::Create( + std::move(resource1->get_mailbox_texture()->callback)) + ->OnMailboxTextureReleased(); KickMessageLoop(); @@ -142,7 +146,9 @@ mojo::gfx::composition::ResourcePtr resource1 = renderer.BindTextureResource(std::move(texture1)); EXPECT_NE(resource1.get(), nullptr); - resource1->get_mailbox_texture()->callback->OnMailboxTextureReleased(); + MailboxTextureCallbackPtr::Create( + std::move(resource1->get_mailbox_texture()->callback)) + ->OnMailboxTextureReleased(); KickMessageLoop(); @@ -198,7 +204,9 @@ EXPECT_NE(resource1.get(), nullptr); gl_context_->Destroy(); - resource1->get_mailbox_texture()->callback->OnMailboxTextureReleased(); + MailboxTextureCallbackPtr::Create( + std::move(resource1->get_mailbox_texture()->callback)) + ->OnMailboxTextureReleased(); KickMessageLoop();
diff --git a/mojo/ui/view_provider_app.cc b/mojo/ui/view_provider_app.cc index e7b9dd5..432f00e 100644 --- a/mojo/ui/view_provider_app.cc +++ b/mojo/ui/view_provider_app.cc
@@ -4,6 +4,8 @@ #include "mojo/ui/view_provider_app.h" +#include <utility> + #include "base/command_line.h" #include "base/logging.h" @@ -23,9 +25,9 @@ void CreateView( mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request, mojo::InterfaceRequest<mojo::ServiceProvider> services, - mojo::ServiceProviderPtr exposed_services) override { + mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services) override { app_->CreateView(this, view_provider_url_, view_owner_request.Pass(), - services.Pass(), exposed_services.Pass()); + services.Pass(), std::move(exposed_services)); } ViewProviderApp* app_; @@ -67,7 +69,7 @@ const std::string& view_provider_url, mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request, mojo::InterfaceRequest<mojo::ServiceProvider> services, - mojo::ServiceProviderPtr exposed_services) { + mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services) { CreateView(view_provider_url, view_owner_request.Pass(), services.Pass(), exposed_services.Pass()); }
diff --git a/mojo/ui/view_provider_app.h b/mojo/ui/view_provider_app.h index f5c4b35..ff174f5 100644 --- a/mojo/ui/view_provider_app.h +++ b/mojo/ui/view_provider_app.h
@@ -54,7 +54,7 @@ const std::string& view_provider_url, mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request, mojo::InterfaceRequest<mojo::ServiceProvider> services, - mojo::ServiceProviderPtr exposed_services) = 0; + mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services) = 0; private: class DelegatingViewProvider; @@ -68,7 +68,7 @@ const std::string& view_provider_url, mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request, mojo::InterfaceRequest<mojo::ServiceProvider> services, - mojo::ServiceProviderPtr exposed_services); + mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services); mojo::ApplicationImpl* app_impl_ = nullptr; mojo::StrongBindingSet<mojo::ui::ViewProvider> bindings_;
diff --git a/services/authenticating_url_loader_interceptor/authenticating_url_loader_interceptor_factory.cc b/services/authenticating_url_loader_interceptor/authenticating_url_loader_interceptor_factory.cc index 58a8849..825855c 100644 --- a/services/authenticating_url_loader_interceptor/authenticating_url_loader_interceptor_factory.cc +++ b/services/authenticating_url_loader_interceptor/authenticating_url_loader_interceptor_factory.cc
@@ -4,6 +4,8 @@ #include "services/authenticating_url_loader_interceptor/authenticating_url_loader_interceptor_factory.h" +#include <utility> + #include "base/bind.h" #include "base/logging.h" #include "base/stl_util.h" @@ -15,11 +17,13 @@ AuthenticatingURLLoaderInterceptorFactory:: AuthenticatingURLLoaderInterceptorFactory( mojo::InterfaceRequest<URLLoaderInterceptorFactory> request, - authentication::AuthenticationServicePtr authentication_service, + mojo::InterfaceHandle<authentication::AuthenticationService> + authentication_service, mojo::ApplicationImpl* app, std::map<GURL, std::string>* cached_tokens) : binding_(this, request.Pass()), - authentication_service_(authentication_service.Pass()), + authentication_service_(authentication::AuthenticationServicePtr::Create( + std::move(authentication_service))), app_(app), cached_tokens_(cached_tokens) { app_->ConnectToService("mojo:network_service", &network_service_);
diff --git a/services/authenticating_url_loader_interceptor/authenticating_url_loader_interceptor_factory.h b/services/authenticating_url_loader_interceptor/authenticating_url_loader_interceptor_factory.h index 2712e0b..62a3d81 100644 --- a/services/authenticating_url_loader_interceptor/authenticating_url_loader_interceptor_factory.h +++ b/services/authenticating_url_loader_interceptor/authenticating_url_loader_interceptor_factory.h
@@ -25,7 +25,8 @@ public: AuthenticatingURLLoaderInterceptorFactory( mojo::InterfaceRequest<URLLoaderInterceptorFactory> request, - authentication::AuthenticationServicePtr authentication_service, + mojo::InterfaceHandle<authentication::AuthenticationService> + authentication_service, mojo::ApplicationImpl* app, std::map<GURL, std::string>* cached_tokens); ~AuthenticatingURLLoaderInterceptorFactory() override;
diff --git a/services/authenticating_url_loader_interceptor/authenticating_url_loader_interceptor_meta_factory_impl.cc b/services/authenticating_url_loader_interceptor/authenticating_url_loader_interceptor_meta_factory_impl.cc index f654821..15b4541 100644 --- a/services/authenticating_url_loader_interceptor/authenticating_url_loader_interceptor_meta_factory_impl.cc +++ b/services/authenticating_url_loader_interceptor/authenticating_url_loader_interceptor_meta_factory_impl.cc
@@ -4,6 +4,8 @@ #include "services/authenticating_url_loader_interceptor/authenticating_url_loader_interceptor_meta_factory_impl.h" +#include <utility> + #include "mojo/public/cpp/application/application_impl.h" #include "services/authenticating_url_loader_interceptor/authenticating_url_loader_interceptor_factory.h" @@ -25,10 +27,11 @@ void AuthenticatingURLLoaderInterceptorMetaFactoryImpl:: CreateURLLoaderInterceptorFactory( mojo::InterfaceRequest<URLLoaderInterceptorFactory> factory_request, - authentication::AuthenticationServicePtr authentication_service) { - new AuthenticatingURLLoaderInterceptorFactory(factory_request.Pass(), - authentication_service.Pass(), - app_, cached_tokens_); + InterfaceHandle<authentication::AuthenticationService> + authentication_service) { + new AuthenticatingURLLoaderInterceptorFactory( + factory_request.Pass(), std::move(authentication_service), app_, + cached_tokens_); } } // namespace mojo
diff --git a/services/authenticating_url_loader_interceptor/authenticating_url_loader_interceptor_meta_factory_impl.h b/services/authenticating_url_loader_interceptor/authenticating_url_loader_interceptor_meta_factory_impl.h index 9929de1..5b3a047 100644 --- a/services/authenticating_url_loader_interceptor/authenticating_url_loader_interceptor_meta_factory_impl.h +++ b/services/authenticating_url_loader_interceptor/authenticating_url_loader_interceptor_meta_factory_impl.h
@@ -32,7 +32,8 @@ // AuthenticatingURLLoaderInterceptorMetaFactory: void CreateURLLoaderInterceptorFactory( mojo::InterfaceRequest<URLLoaderInterceptorFactory> factory_request, - authentication::AuthenticationServicePtr authentication_service) override; + InterfaceHandle<authentication::AuthenticationService> + authentication_service) override; StrongBinding<AuthenticatingURLLoaderInterceptorMetaFactory> binding_; ApplicationImpl* app_;
diff --git a/services/dart/dart_tracing.cc b/services/dart/dart_tracing.cc index d3c4353..0ff1b4d 100644 --- a/services/dart/dart_tracing.cc +++ b/services/dart/dart_tracing.cc
@@ -4,6 +4,8 @@ #include "services/dart/dart_tracing.h" +#include <utility> + #include "dart/runtime/include/dart_tools_api.h" #include "mojo/public/cpp/application/application_impl.h" @@ -44,10 +46,11 @@ } // tracing::TraceProvider implementation: -void DartTraceProvider::StartTracing(const mojo::String& categories, - tracing::TraceRecorderPtr recorder) { +void DartTraceProvider::StartTracing( + const mojo::String& categories, + mojo::InterfaceHandle<tracing::TraceRecorder> recorder) { DCHECK(!recorder_.get()); - recorder_ = recorder.Pass(); + recorder_ = tracing::TraceRecorderPtr::Create(std::move(recorder)); DartTimelineController::Enable(categories); }
diff --git a/services/dart/dart_tracing.h b/services/dart/dart_tracing.h index ec5904e..15f423d 100644 --- a/services/dart/dart_tracing.h +++ b/services/dart/dart_tracing.h
@@ -28,8 +28,9 @@ private: // tracing::TraceProvider implementation: - void StartTracing(const mojo::String& categories, - tracing::TraceRecorderPtr recorder) override; + void StartTracing( + const mojo::String& categories, + mojo::InterfaceHandle<tracing::TraceRecorder> recorder) override; void StopTracing() override; void SplitAndRecord(char* data, size_t length);
diff --git a/services/gfx/compositor/backend/gpu_output.cc b/services/gfx/compositor/backend/gpu_output.cc index e5fe85e..950de50 100644 --- a/services/gfx/compositor/backend/gpu_output.cc +++ b/services/gfx/compositor/backend/gpu_output.cc
@@ -22,13 +22,14 @@ base::MessageLoop::TYPE_DEFAULT); } -GpuOutput::GpuOutput(mojo::ContextProviderPtr context_provider, - const SchedulerCallbacks& scheduler_callbacks, - const base::Closure& error_callback) +GpuOutput::GpuOutput( + mojo::InterfaceHandle<mojo::ContextProvider> context_provider, + const SchedulerCallbacks& scheduler_callbacks, + const base::Closure& error_callback) : frame_queue_(std::make_shared<FrameQueue>()), - scheduler_(std::make_shared<VsyncScheduler>(base::MessageLoop::current() - ->task_runner(), - scheduler_callbacks)), + scheduler_(std::make_shared<VsyncScheduler>( + base::MessageLoop::current()->task_runner(), + scheduler_callbacks)), rasterizer_delegate_( make_scoped_ptr(new RasterizerDelegate(frame_queue_))) { DCHECK(context_provider); @@ -44,9 +45,8 @@ FROM_HERE, base::Bind(&RasterizerDelegate::CreateRasterizer, base::Unretained(rasterizer_delegate_.get()), - base::Passed(context_provider.PassInterfaceHandle()), - scheduler_, base::MessageLoop::current()->task_runner(), - error_callback)); + base::Passed(std::move(context_provider)), scheduler_, + base::MessageLoop::current()->task_runner(), error_callback)); } GpuOutput::~GpuOutput() {
diff --git a/services/gfx/compositor/backend/gpu_output.h b/services/gfx/compositor/backend/gpu_output.h index 6f62a14..fe7db0b 100644 --- a/services/gfx/compositor/backend/gpu_output.h +++ b/services/gfx/compositor/backend/gpu_output.h
@@ -25,7 +25,7 @@ // Renderer backed by a ContextProvider. class GpuOutput : public Output { public: - GpuOutput(mojo::ContextProviderPtr context_provider, + GpuOutput(mojo::InterfaceHandle<mojo::ContextProvider> context_provider, const SchedulerCallbacks& scheduler_callbacks, const base::Closure& error_callback); ~GpuOutput() override;
diff --git a/services/gfx/compositor/backend/gpu_rasterizer.cc b/services/gfx/compositor/backend/gpu_rasterizer.cc index bdd6aa3..9f5cf0d 100644 --- a/services/gfx/compositor/backend/gpu_rasterizer.cc +++ b/services/gfx/compositor/backend/gpu_rasterizer.cc
@@ -12,6 +12,7 @@ #include <GLES2/gl2extmojo.h> #include <MGL/mgl.h> #include <MGL/mgl_onscreen.h> +#include <utility> #include "base/bind.h" #include "base/location.h" @@ -50,7 +51,8 @@ base::Bind(&GpuRasterizer::InitContext, base::Unretained(this))); } -void GpuRasterizer::InitContext(mojo::CommandBufferPtr command_buffer) { +void GpuRasterizer::InitContext( + mojo::InterfaceHandle<mojo::CommandBuffer> command_buffer) { DCHECK(!gl_context_); DCHECK(!ganesh_context_); DCHECK(!ganesh_surface_); @@ -61,7 +63,8 @@ return; } - gl_context_ = mojo::GLContext::CreateFromCommandBuffer(command_buffer.Pass()); + gl_context_ = mojo::GLContext::CreateFromCommandBuffer( + mojo::CommandBufferPtr::Create(std::move(command_buffer))); gl_context_->AddObserver(this); ganesh_context_.reset(new mojo::skia::GaneshContext(gl_context_));
diff --git a/services/gfx/compositor/backend/gpu_rasterizer.h b/services/gfx/compositor/backend/gpu_rasterizer.h index 65eb5bb..566883f 100644 --- a/services/gfx/compositor/backend/gpu_rasterizer.h +++ b/services/gfx/compositor/backend/gpu_rasterizer.h
@@ -46,7 +46,7 @@ void OnContextLost() override; void CreateContext(); - void InitContext(mojo::CommandBufferPtr command_buffer); + void InitContext(mojo::InterfaceHandle<mojo::CommandBuffer> command_buffer); void DestroyContext(); void OnContextProviderConnectionError();
diff --git a/services/gfx/compositor/compositor_engine.cc b/services/gfx/compositor/compositor_engine.cc index 8f69908..448d689 100644 --- a/services/gfx/compositor/compositor_engine.cc +++ b/services/gfx/compositor/compositor_engine.cc
@@ -99,7 +99,7 @@ } void CompositorEngine::CreateRenderer( - mojo::ContextProviderPtr context_provider, + mojo::InterfaceHandle<mojo::ContextProvider> context_provider, mojo::InterfaceRequest<mojo::gfx::composition::Renderer> renderer_request, const mojo::String& label) { DCHECK(context_provider);
diff --git a/services/gfx/compositor/compositor_engine.h b/services/gfx/compositor/compositor_engine.h index c9d459d..0d06369 100644 --- a/services/gfx/compositor/compositor_engine.h +++ b/services/gfx/compositor/compositor_engine.h
@@ -34,7 +34,7 @@ // Creates a scene graph renderer. void CreateRenderer( - mojo::ContextProviderPtr context_provider, + mojo::InterfaceHandle<mojo::ContextProvider> context_provider, mojo::InterfaceRequest<mojo::gfx::composition::Renderer> renderer_request, const mojo::String& label);
diff --git a/services/gfx/compositor/compositor_impl.cc b/services/gfx/compositor/compositor_impl.cc index 5d14003..56ed4f5 100644 --- a/services/gfx/compositor/compositor_impl.cc +++ b/services/gfx/compositor/compositor_impl.cc
@@ -4,6 +4,8 @@ #include "services/gfx/compositor/compositor_impl.h" +#include <utility> + #include "services/gfx/compositor/scene_impl.h" namespace compositor { @@ -22,10 +24,10 @@ } void CompositorImpl::CreateRenderer( - mojo::ContextProviderPtr context_provider, + mojo::InterfaceHandle<mojo::ContextProvider> context_provider, mojo::InterfaceRequest<mojo::gfx::composition::Renderer> renderer_request, const mojo::String& label) { - engine_->CreateRenderer(context_provider.Pass(), renderer_request.Pass(), + engine_->CreateRenderer(std::move(context_provider), renderer_request.Pass(), label); }
diff --git a/services/gfx/compositor/compositor_impl.h b/services/gfx/compositor/compositor_impl.h index 78e35ad..fd5956f 100644 --- a/services/gfx/compositor/compositor_impl.h +++ b/services/gfx/compositor/compositor_impl.h
@@ -25,7 +25,7 @@ const mojo::String& label, const CreateSceneCallback& callback) override; void CreateRenderer( - mojo::ContextProviderPtr context_provider, + mojo::InterfaceHandle<mojo::ContextProvider> context_provider, mojo::InterfaceRequest<mojo::gfx::composition::Renderer> renderer_request, const mojo::String& label) override;
diff --git a/services/gfx/compositor/graph/scene_def.cc b/services/gfx/compositor/graph/scene_def.cc index ae77273..a23c108 100644 --- a/services/gfx/compositor/graph/scene_def.cc +++ b/services/gfx/compositor/graph/scene_def.cc
@@ -5,6 +5,7 @@ #include "services/gfx/compositor/graph/scene_def.h" #include <ostream> +#include <utility> #include "base/bind.h" #include "base/logging.h" @@ -292,7 +293,9 @@ base::MessageLoop::current()->task_runner(), base::Bind( &ReleaseMailboxTexture, - base::Passed(mailbox_texture_resource_decl->callback.Pass()))); + base::Passed( + mojo::gfx::composition::MailboxTextureCallbackPtr::Create( + std::move(mailbox_texture_resource_decl->callback))))); if (!image) { err << "Could not create MailboxTexture"; return nullptr;
diff --git a/services/gfx/compositor/scene_impl.cc b/services/gfx/compositor/scene_impl.cc index c02486e..5db165c 100644 --- a/services/gfx/compositor/scene_impl.cc +++ b/services/gfx/compositor/scene_impl.cc
@@ -4,6 +4,8 @@ #include "services/gfx/compositor/scene_impl.h" +#include <utility> + #include "base/bind.h" #include "base/bind_helpers.h" @@ -25,8 +27,10 @@ SceneImpl::~SceneImpl() {} -void SceneImpl::SetListener(mojo::gfx::composition::SceneListenerPtr listener) { - engine_->SetListener(state_, listener.Pass()); +void SceneImpl::SetListener( + mojo::InterfaceHandle<mojo::gfx::composition::SceneListener> listener) { + engine_->SetListener(state_, mojo::gfx::composition::SceneListenerPtr::Create( + std::move(listener))); } void SceneImpl::Update(mojo::gfx::composition::SceneUpdatePtr update) {
diff --git a/services/gfx/compositor/scene_impl.h b/services/gfx/compositor/scene_impl.h index a7def23..f145c15 100644 --- a/services/gfx/compositor/scene_impl.h +++ b/services/gfx/compositor/scene_impl.h
@@ -32,7 +32,8 @@ private: // |Scene|: - void SetListener(mojo::gfx::composition::SceneListenerPtr listener) override; + void SetListener(mojo::InterfaceHandle<mojo::gfx::composition::SceneListener> + listener) override; void Update(mojo::gfx::composition::SceneUpdatePtr update) override; void Publish(mojo::gfx::composition::SceneMetadataPtr metadata) override; void GetScheduler(
diff --git a/services/gles2/command_buffer_driver.cc b/services/gles2/command_buffer_driver.cc index 1c3f9f6..fac4319 100644 --- a/services/gles2/command_buffer_driver.cc +++ b/services/gles2/command_buffer_driver.cc
@@ -4,6 +4,8 @@ #include "services/gles2/command_buffer_driver.h" +#include <utility> + #include "base/bind.h" #include "base/macros.h" #include "base/memory/shared_memory.h" @@ -85,11 +87,13 @@ } void CommandBufferDriver::Initialize( - mojo::CommandBufferSyncClientPtr sync_client, - mojo::CommandBufferLostContextObserverPtr loss_observer, + mojo::InterfaceHandle<mojo::CommandBufferSyncClient> sync_client, + mojo::InterfaceHandle<mojo::CommandBufferLostContextObserver> loss_observer, mojo::ScopedSharedBufferHandle shared_state) { - sync_client_ = sync_client.Pass(); - loss_observer_ = loss_observer.Pass(); + sync_client_ = + mojo::CommandBufferSyncClientPtr::Create(std::move(sync_client)); + loss_observer_ = mojo::CommandBufferLostContextObserverPtr::Create( + std::move(loss_observer)); bool success = DoInitialize(shared_state.Pass()); mojo::GpuCapabilitiesPtr capabilities = success ? mojo::GpuCapabilities::From(decoder_->GetCapabilities())
diff --git a/services/gles2/command_buffer_driver.h b/services/gles2/command_buffer_driver.h index 40a75e0..1669ceb 100644 --- a/services/gles2/command_buffer_driver.h +++ b/services/gles2/command_buffer_driver.h
@@ -58,9 +58,11 @@ void set_client(scoped_ptr<Client> client) { client_ = client.Pass(); } - void Initialize(mojo::CommandBufferSyncClientPtr sync_client, - mojo::CommandBufferLostContextObserverPtr loss_observer, - mojo::ScopedSharedBufferHandle shared_state); + void Initialize( + mojo::InterfaceHandle<mojo::CommandBufferSyncClient> sync_client, + mojo::InterfaceHandle<mojo::CommandBufferLostContextObserver> + loss_observer, + mojo::ScopedSharedBufferHandle shared_state); void SetGetBuffer(int32_t buffer); void Flush(int32_t put_offset); void MakeProgress(int32_t last_get_offset);
diff --git a/services/gles2/command_buffer_impl.cc b/services/gles2/command_buffer_impl.cc index f999c8e..db1f677 100644 --- a/services/gles2/command_buffer_impl.cc +++ b/services/gles2/command_buffer_impl.cc
@@ -4,6 +4,8 @@ #include "services/gles2/command_buffer_impl.h" +#include <utility> + #include "base/bind.h" #include "base/message_loop/message_loop.h" #include "gpu/command_buffer/service/sync_point_manager.h" @@ -42,7 +44,7 @@ base::WeakPtr<CommandBufferImpl> command_buffer_; scoped_refptr<base::SingleThreadTaskRunner> control_task_runner_; }; -} +} // namespace CommandBufferImpl::CommandBufferImpl( mojo::InterfaceRequest<mojo::CommandBuffer> request, @@ -72,11 +74,12 @@ } void CommandBufferImpl::Initialize( - mojo::CommandBufferSyncClientPtr sync_client, - mojo::CommandBufferSyncPointClientPtr sync_point_client, - mojo::CommandBufferLostContextObserverPtr loss_observer, + mojo::InterfaceHandle<mojo::CommandBufferSyncClient> sync_client, + mojo::InterfaceHandle<mojo::CommandBufferSyncPointClient> sync_point_client, + mojo::InterfaceHandle<mojo::CommandBufferLostContextObserver> loss_observer, mojo::ScopedSharedBufferHandle shared_state) { - sync_point_client_ = sync_point_client.Pass(); + sync_point_client_ = mojo::CommandBufferSyncPointClientPtr::Create( + std::move(sync_point_client)); driver_task_runner_->PostTask( FROM_HERE, base::Bind(&CommandBufferDriver::Initialize,
diff --git a/services/gles2/command_buffer_impl.h b/services/gles2/command_buffer_impl.h index a781e9f..b703cc9 100644 --- a/services/gles2/command_buffer_impl.h +++ b/services/gles2/command_buffer_impl.h
@@ -38,10 +38,13 @@ scoped_ptr<CommandBufferDriver> driver); ~CommandBufferImpl() override; - void Initialize(mojo::CommandBufferSyncClientPtr sync_client, - mojo::CommandBufferSyncPointClientPtr sync_point_client, - mojo::CommandBufferLostContextObserverPtr loss_observer, - mojo::ScopedSharedBufferHandle shared_state) override; + void Initialize( + mojo::InterfaceHandle<mojo::CommandBufferSyncClient> sync_client, + mojo::InterfaceHandle<mojo::CommandBufferSyncPointClient> + sync_point_client, + mojo::InterfaceHandle<mojo::CommandBufferLostContextObserver> + loss_observer, + mojo::ScopedSharedBufferHandle shared_state) override; void SetGetBuffer(int32_t buffer) override; void Flush(int32_t put_offset) override; void MakeProgress(int32_t last_get_offset) override;
diff --git a/services/http_server/http_server_impl.cc b/services/http_server/http_server_impl.cc index fa7f5b3..c05f39c 100644 --- a/services/http_server/http_server_impl.cc +++ b/services/http_server/http_server_impl.cc
@@ -4,6 +4,8 @@ #include "services/http_server/http_server_impl.h" +#include <utility> + #include "base/bind.h" #include "base/logging.h" #include "mojo/public/cpp/application/application_impl.h" @@ -33,14 +35,15 @@ } void HttpServerImpl::SetHandler(const mojo::String& path, - HttpHandlerPtr http_handler, + mojo::InterfaceHandle<HttpHandler> http_handler, const mojo::Callback<void(bool)>& callback) { for (const auto& handler : handlers_) { if (handler->pattern->pattern() == path) callback.Run(false); } - Handler* handler = new Handler(path, http_handler.Pass()); + Handler* handler = + new Handler(path, HttpHandlerPtr::Create(std::move(http_handler))); handler->http_handler.set_connection_error_handler( [this, handler]() { OnHandlerConnectionError(handler); }); handlers_.push_back(handler);
diff --git a/services/http_server/http_server_impl.h b/services/http_server/http_server_impl.h index 0c96ece..8e2d757 100644 --- a/services/http_server/http_server_impl.h +++ b/services/http_server/http_server_impl.h
@@ -35,7 +35,7 @@ // HttpServer: void SetHandler(const mojo::String& path, - HttpHandlerPtr http_handler, + mojo::InterfaceHandle<HttpHandler> http_handler, const mojo::Callback<void(bool)>& callback) override; void GetPort(const GetPortCallback& callback) override;
diff --git a/services/keyboard/linux/keyboard_service_impl.cc b/services/keyboard/linux/keyboard_service_impl.cc index f8b6afc..e9fd9eb 100644 --- a/services/keyboard/linux/keyboard_service_impl.cc +++ b/services/keyboard/linux/keyboard_service_impl.cc
@@ -24,9 +24,9 @@ } void LinuxKeyboardServiceImpl::Show( - keyboard::KeyboardClientPtr client, + mojo::InterfaceHandle<keyboard::KeyboardClient> client, keyboard::KeyboardType type) { - client_ = client.Pass(); + client_ = keyboard::KeyboardClientPtr::Create(std::move(client)); } void LinuxKeyboardServiceImpl::ShowByRequest() {
diff --git a/services/keyboard/linux/keyboard_service_impl.h b/services/keyboard/linux/keyboard_service_impl.h index bb4037c..6ac6a89 100644 --- a/services/keyboard/linux/keyboard_service_impl.h +++ b/services/keyboard/linux/keyboard_service_impl.h
@@ -23,7 +23,7 @@ ~LinuxKeyboardServiceImpl() override; // |KeyboardService| overrides: - void Show(keyboard::KeyboardClientPtr client, + void Show(mojo::InterfaceHandle<keyboard::KeyboardClient> client, keyboard::KeyboardType type) override; void ShowByRequest() override; void Hide() override;
diff --git a/services/native_support/process_impl.cc b/services/native_support/process_impl.cc index 7e3deb9..4e72164 100644 --- a/services/native_support/process_impl.cc +++ b/services/native_support/process_impl.cc
@@ -26,6 +26,8 @@ #include "services/native_support/process_controller_impl.h" #include "services/native_support/process_io_redirection.h" +using mojo::files::FilePtr; + namespace native_support { namespace { @@ -60,9 +62,9 @@ mojo::Array<uint8_t> path, mojo::Array<mojo::Array<uint8_t>> argv, mojo::Array<mojo::Array<uint8_t>> envp, - mojo::files::FilePtr stdin_file, - mojo::files::FilePtr stdout_file, - mojo::files::FilePtr stderr_file, + mojo::InterfaceHandle<mojo::files::File> stdin_file, + mojo::InterfaceHandle<mojo::files::File> stdout_file, + mojo::InterfaceHandle<mojo::files::File> stderr_file, mojo::InterfaceRequest<ProcessController> process_controller, const SpawnCallback& callback) { std::vector<int> fds_to_inherit(3, -1); @@ -108,9 +110,10 @@ std::unique_ptr<ProcessIORedirection> process_io_redirection( new ProcessIORedirectionForStdIO( - stdin_file.Pass(), stdout_file.Pass(), stderr_file.Pass(), - stdin_parent_fd.Pass(), stdout_parent_fd.Pass(), - stderr_parent_fd.Pass())); + FilePtr::Create(std::move(stdin_file)), + FilePtr::Create(std::move(stdout_file)), + FilePtr::Create(std::move(stderr_file)), stdin_parent_fd.Pass(), + stdout_parent_fd.Pass(), stderr_parent_fd.Pass())); SpawnImpl(path.Pass(), argv.Pass(), envp.Pass(), std::move(process_io_redirection), fds_to_inherit, @@ -121,7 +124,7 @@ mojo::Array<uint8_t> path, mojo::Array<mojo::Array<uint8_t>> argv, mojo::Array<mojo::Array<uint8_t>> envp, - mojo::files::FilePtr terminal_file, + mojo::InterfaceHandle<mojo::files::File> terminal_file, mojo::InterfaceRequest<ProcessController> process_controller, const SpawnWithTerminalCallback& callback) { DCHECK(terminal_file); @@ -150,8 +153,8 @@ fds_to_inherit[STDERR_FILENO] = stderr_fd.get(); std::unique_ptr<ProcessIORedirection> process_io_redirection( - new ProcessIORedirectionForTerminal(terminal_file.Pass(), - master_fd.Pass())); + new ProcessIORedirectionForTerminal( + FilePtr::Create(std::move(terminal_file)), master_fd.Pass())); SpawnImpl(path.Pass(), argv.Pass(), envp.Pass(), std::move(process_io_redirection), fds_to_inherit,
diff --git a/services/native_support/process_impl.h b/services/native_support/process_impl.h index 0368718..8632b2e 100644 --- a/services/native_support/process_impl.h +++ b/services/native_support/process_impl.h
@@ -34,16 +34,16 @@ void Spawn(mojo::Array<uint8_t> path, mojo::Array<mojo::Array<uint8_t>> argv, mojo::Array<mojo::Array<uint8_t>> envp, - mojo::files::FilePtr stdin_file, - mojo::files::FilePtr stdout_file, - mojo::files::FilePtr stderr_file, + mojo::InterfaceHandle<mojo::files::File> stdin_file, + mojo::InterfaceHandle<mojo::files::File> stdout_file, + mojo::InterfaceHandle<mojo::files::File> stderr_file, mojo::InterfaceRequest<ProcessController> process_controller, const SpawnCallback& callback) override; void SpawnWithTerminal( mojo::Array<uint8_t> path, mojo::Array<mojo::Array<uint8_t>> argv, mojo::Array<mojo::Array<uint8_t>> envp, - mojo::files::FilePtr terminal_file, + mojo::InterfaceHandle<mojo::files::File> terminal_file, mojo::InterfaceRequest<ProcessController> process_controller, const SpawnWithTerminalCallback& callback) override;
diff --git a/services/native_viewport/native_viewport_impl.cc b/services/native_viewport/native_viewport_impl.cc index a07ca9e..7307714 100644 --- a/services/native_viewport/native_viewport_impl.cc +++ b/services/native_viewport/native_viewport_impl.cc
@@ -90,8 +90,9 @@ } void NativeViewportImpl::SetEventDispatcher( - mojo::NativeViewportEventDispatcherPtr dispatcher) { - event_dispatcher_ = dispatcher.Pass(); + mojo::InterfaceHandle<mojo::NativeViewportEventDispatcher> dispatcher) { + event_dispatcher_ = + mojo::NativeViewportEventDispatcherPtr::Create(std::move(dispatcher)); } void NativeViewportImpl::OnMetricsChanged(mojo::ViewportMetricsPtr metrics) {
diff --git a/services/native_viewport/native_viewport_impl.h b/services/native_viewport/native_viewport_impl.h index 3391e88..bad5f2a 100644 --- a/services/native_viewport/native_viewport_impl.h +++ b/services/native_viewport/native_viewport_impl.h
@@ -55,7 +55,8 @@ void GetContextProvider( mojo::InterfaceRequest<mojo::ContextProvider> request) override; void SetEventDispatcher( - mojo::NativeViewportEventDispatcherPtr dispatcher) override; + mojo::InterfaceHandle<mojo::NativeViewportEventDispatcher> dispatcher) + override; // PlatformViewport::Delegate implementation. void OnMetricsChanged(mojo::ViewportMetricsPtr metrics) override;
diff --git a/services/native_viewport/onscreen_context_provider.cc b/services/native_viewport/onscreen_context_provider.cc index fcdf543..00f07a9 100644 --- a/services/native_viewport/onscreen_context_provider.cc +++ b/services/native_viewport/onscreen_context_provider.cc
@@ -46,14 +46,16 @@ } void OnscreenContextProvider::Create( - mojo::ViewportParameterListenerPtr viewport_parameter_listener, + mojo::InterfaceHandle<mojo::ViewportParameterListener> + viewport_parameter_listener, const CreateCallback& callback) { if (!pending_create_callback_.is_null()) { DCHECK(!command_buffer_impl_); pending_create_callback_.Run(nullptr); } - pending_listener_ = viewport_parameter_listener.Pass(); + pending_listener_ = mojo::ViewportParameterListenerPtr::Create( + std::move(viewport_parameter_listener)); pending_create_callback_ = callback; if (widget_ != gfx::kNullAcceleratedWidget)
diff --git a/services/native_viewport/onscreen_context_provider.h b/services/native_viewport/onscreen_context_provider.h index cb23d9a..e2d5076 100644 --- a/services/native_viewport/onscreen_context_provider.h +++ b/services/native_viewport/onscreen_context_provider.h
@@ -33,7 +33,8 @@ }; private: // mojo::ContextProvider implementation: - void Create(mojo::ViewportParameterListenerPtr viewport_parameter_listener, + void Create(mojo::InterfaceHandle<mojo::ViewportParameterListener> + viewport_parameter_listener, const CreateCallback& callback) override; // gles2::CommandBufferImpl::Observer implementation:
diff --git a/services/ui/input_manager/input_associate.cc b/services/ui/input_manager/input_associate.cc index c97f705..72dd596 100644 --- a/services/ui/input_manager/input_associate.cc +++ b/services/ui/input_manager/input_associate.cc
@@ -4,6 +4,8 @@ #include "services/ui/input_manager/input_associate.h" +#include <utility> + #include "base/bind.h" #include "base/logging.h" #include "mojo/public/cpp/bindings/interface_request.h" @@ -14,8 +16,9 @@ InputAssociate::~InputAssociate() {} -void InputAssociate::Connect(mojo::ui::ViewInspectorPtr inspector, - const ConnectCallback& callback) { +void InputAssociate::Connect( + mojo::InterfaceHandle<mojo::ui::ViewInspector> inspector, + const ConnectCallback& callback) { DCHECK(inspector); // checked by mojom auto info = mojo::ui::ViewAssociateInfo::New(); @@ -50,12 +53,13 @@ } } -void InputAssociate::SetListener(mojo::ui::ViewToken* view_token, - mojo::ui::InputListenerPtr listener) { +void InputAssociate::SetListener( + mojo::ui::ViewToken* view_token, + mojo::InterfaceHandle<mojo::ui::InputListener> listener) { // TODO(jeffbrown): This simple hack just hooks up the first listener // ever seen. if (!listener_) - listener_ = listener.Pass(); + listener_ = mojo::ui::InputListenerPtr::Create(std::move(listener)); } void InputAssociate::DispatchEvent(mojo::ui::ViewTreeToken* view_tree_token, @@ -81,8 +85,8 @@ InputAssociate::InputConnectionImpl::~InputConnectionImpl() {} void InputAssociate::InputConnectionImpl::SetListener( - mojo::ui::InputListenerPtr listener) { - associate_->SetListener(view_token_.get(), listener.Pass()); + mojo::InterfaceHandle<mojo::ui::InputListener> listener) { + associate_->SetListener(view_token_.get(), std::move(listener)); } InputAssociate::InputDispatcherImpl::InputDispatcherImpl(
diff --git a/services/ui/input_manager/input_associate.h b/services/ui/input_manager/input_associate.h index 7f2fd7e..3459eed 100644 --- a/services/ui/input_manager/input_associate.h +++ b/services/ui/input_manager/input_associate.h
@@ -29,7 +29,8 @@ ~InputConnectionImpl() override; private: - void SetListener(mojo::ui::InputListenerPtr listener) override; + void SetListener( + mojo::InterfaceHandle<mojo::ui::InputListener> listener) override; InputAssociate* const associate_; mojo::ui::ViewTokenPtr view_token_; @@ -55,7 +56,7 @@ }; // |ViewAssociate|: - void Connect(mojo::ui::ViewInspectorPtr inspector, + void Connect(mojo::InterfaceHandle<mojo::ui::ViewInspector> inspector, const ConnectCallback& callback) override; void ConnectToViewService( mojo::ui::ViewTokenPtr view_token, @@ -68,7 +69,7 @@ // Incoming service calls. void SetListener(mojo::ui::ViewToken* view_token, - mojo::ui::InputListenerPtr listener); + mojo::InterfaceHandle<mojo::ui::InputListener> listener); void DispatchEvent(mojo::ui::ViewTreeToken* view_tree_token, mojo::EventPtr event);
diff --git a/services/ui/view_manager/view_host_impl.cc b/services/ui/view_manager/view_host_impl.cc index 7e32e89..0bd6a57 100644 --- a/services/ui/view_manager/view_host_impl.cc +++ b/services/ui/view_manager/view_host_impl.cc
@@ -34,8 +34,9 @@ registry_->RequestLayout(state_); } -void ViewHostImpl::AddChild(uint32_t child_key, - mojo::ui::ViewOwnerPtr child_view_owner) { +void ViewHostImpl::AddChild( + uint32_t child_key, + mojo::InterfaceHandle<mojo::ui::ViewOwner> child_view_owner) { registry_->AddChild(state_, child_key, child_view_owner.Pass()); }
diff --git a/services/ui/view_manager/view_host_impl.h b/services/ui/view_manager/view_host_impl.h index 2ed54f6..053ad52 100644 --- a/services/ui/view_manager/view_host_impl.h +++ b/services/ui/view_manager/view_host_impl.h
@@ -31,8 +31,9 @@ void CreateScene( mojo::InterfaceRequest<mojo::gfx::composition::Scene> scene) override; void RequestLayout() override; - void AddChild(uint32_t child_key, - mojo::ui::ViewOwnerPtr child_view_owner) override; + void AddChild( + uint32_t child_key, + mojo::InterfaceHandle<mojo::ui::ViewOwner> child_view_owner) override; void RemoveChild(uint32_t child_key, mojo::InterfaceRequest<mojo::ui::ViewOwner> transferred_view_owner_request) override;
diff --git a/services/ui/view_manager/view_manager_impl.cc b/services/ui/view_manager/view_manager_impl.cc index 22e9483..dbaf9ad 100644 --- a/services/ui/view_manager/view_manager_impl.cc +++ b/services/ui/view_manager/view_manager_impl.cc
@@ -4,6 +4,8 @@ #include "services/ui/view_manager/view_manager_impl.h" +#include <utility> + #include "services/ui/view_manager/view_host_impl.h" #include "services/ui/view_manager/view_tree_host_impl.h" @@ -15,20 +17,22 @@ ViewManagerImpl::~ViewManagerImpl() {} void ViewManagerImpl::RegisterView( - mojo::ui::ViewPtr view, + mojo::InterfaceHandle<mojo::ui::View> view, mojo::InterfaceRequest<mojo::ui::ViewHost> view_host_request, mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request, const mojo::String& label) { - registry_->RegisterView(view.Pass(), view_host_request.Pass(), - view_owner_request.Pass(), label); + registry_->RegisterView(mojo::ui::ViewPtr::Create(std::move(view)), + view_host_request.Pass(), view_owner_request.Pass(), + label); } void ViewManagerImpl::RegisterViewTree( - mojo::ui::ViewTreePtr view_tree, + mojo::InterfaceHandle<mojo::ui::ViewTree> view_tree, mojo::InterfaceRequest<mojo::ui::ViewTreeHost> view_tree_host_request, const mojo::String& label) { - registry_->RegisterViewTree(view_tree.Pass(), view_tree_host_request.Pass(), - label); + registry_->RegisterViewTree( + mojo::ui::ViewTreePtr::Create(std::move(view_tree)), + view_tree_host_request.Pass(), label); } } // namespace view_manager
diff --git a/services/ui/view_manager/view_manager_impl.h b/services/ui/view_manager/view_manager_impl.h index fcb490e..f9edea4 100644 --- a/services/ui/view_manager/view_manager_impl.h +++ b/services/ui/view_manager/view_manager_impl.h
@@ -20,12 +20,12 @@ private: // |ViewManager|: void RegisterView( - mojo::ui::ViewPtr view, + mojo::InterfaceHandle<mojo::ui::View> view, mojo::InterfaceRequest<mojo::ui::ViewHost> view_host_request, mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request, const mojo::String& label) override; void RegisterViewTree( - mojo::ui::ViewTreePtr view_tree, + mojo::InterfaceHandle<mojo::ui::ViewTree> view_tree, mojo::InterfaceRequest<mojo::ui::ViewTreeHost> view_tree_host_request, const mojo::String& label) override;
diff --git a/services/ui/view_manager/view_registry.cc b/services/ui/view_manager/view_registry.cc index c86177a..deba254 100644 --- a/services/ui/view_manager/view_registry.cc +++ b/services/ui/view_manager/view_registry.cc
@@ -177,9 +177,10 @@ InvalidateLayout(view_state); } -void ViewRegistry::AddChild(ViewState* parent_state, - uint32_t child_key, - mojo::ui::ViewOwnerPtr child_view_owner) { +void ViewRegistry::AddChild( + ViewState* parent_state, + uint32_t child_key, + mojo::InterfaceHandle<mojo::ui::ViewOwner> child_view_owner) { DCHECK(IsViewStateRegisteredDebug(parent_state)); DCHECK(child_view_owner); DVLOG(1) << "AddChild: parent=" << parent_state @@ -284,9 +285,10 @@ InvalidateLayoutForRoot(tree_state); } -void ViewRegistry::SetRoot(ViewTreeState* tree_state, - uint32_t root_key, - mojo::ui::ViewOwnerPtr root_view_owner) { +void ViewRegistry::SetRoot( + ViewTreeState* tree_state, + uint32_t root_key, + mojo::InterfaceHandle<mojo::ui::ViewOwner> root_view_owner) { DCHECK(IsViewTreeStateRegisteredDebug(tree_state)); DCHECK(root_view_owner); DVLOG(1) << "SetRoot: tree=" << tree_state << ", root_key=" << root_key;
diff --git a/services/ui/view_manager/view_registry.h b/services/ui/view_manager/view_registry.h index 3f2b7ba..567d18c 100644 --- a/services/ui/view_manager/view_registry.h +++ b/services/ui/view_manager/view_registry.h
@@ -73,7 +73,7 @@ // Destroys |parent_state| if an error occurs. void AddChild(ViewState* parent_state, uint32_t child_key, - mojo::ui::ViewOwnerPtr child_view_owner); + mojo::InterfaceHandle<mojo::ui::ViewOwner> child_view_owner); // Removes a child. // Destroys |parent_state| if an error occurs. @@ -108,7 +108,7 @@ // Destroys |tree_state| if an error occurs. void SetRoot(ViewTreeState* tree_state, uint32_t root_key, - mojo::ui::ViewOwnerPtr root_view_owner); + mojo::InterfaceHandle<mojo::ui::ViewOwner> root_view_owner); // Resets the root of the view tree. // Destroys |tree_state| if an error occurs.
diff --git a/services/ui/view_manager/view_stub.cc b/services/ui/view_manager/view_stub.cc index 8fd5eae..f68dc19 100644 --- a/services/ui/view_manager/view_stub.cc +++ b/services/ui/view_manager/view_stub.cc
@@ -4,6 +4,8 @@ #include "services/ui/view_manager/view_stub.h" +#include <utility> + #include "base/bind.h" #include "base/logging.h" #include "services/ui/view_manager/view_registry.h" @@ -12,8 +14,10 @@ namespace view_manager { -ViewStub::ViewStub(ViewRegistry* registry, mojo::ui::ViewOwnerPtr owner) - : registry_(registry), owner_(owner.Pass()) { +ViewStub::ViewStub(ViewRegistry* registry, + mojo::InterfaceHandle<mojo::ui::ViewOwner> owner) + : registry_(registry), + owner_(mojo::ui::ViewOwnerPtr::Create(std::move(owner))) { DCHECK(registry_); DCHECK(owner_);
diff --git a/services/ui/view_manager/view_stub.h b/services/ui/view_manager/view_stub.h index db031bb..461d0d7 100644 --- a/services/ui/view_manager/view_stub.h +++ b/services/ui/view_manager/view_stub.h
@@ -34,7 +34,8 @@ // Begins the process of resolving a view. // Invokes |ViewRegistry.OnViewResolved| when the token is obtained // from the owner or passes nullptr if an error occurs. - ViewStub(ViewRegistry* registry, mojo::ui::ViewOwnerPtr owner); + ViewStub(ViewRegistry* registry, + mojo::InterfaceHandle<mojo::ui::ViewOwner> owner); ~ViewStub(); // Gets the view state referenced by the stub, or null if the view
diff --git a/services/ui/view_manager/view_tree_host_impl.cc b/services/ui/view_manager/view_tree_host_impl.cc index bbfc208..0cd80be 100644 --- a/services/ui/view_manager/view_tree_host_impl.cc +++ b/services/ui/view_manager/view_tree_host_impl.cc
@@ -28,8 +28,9 @@ registry_->RequestLayout(state_); } -void ViewTreeHostImpl::SetRoot(uint32_t root_key, - mojo::ui::ViewOwnerPtr root_view_owner) { +void ViewTreeHostImpl::SetRoot( + uint32_t root_key, + mojo::InterfaceHandle<mojo::ui::ViewOwner> root_view_owner) { registry_->SetRoot(state_, root_key, root_view_owner.Pass()); }
diff --git a/services/ui/view_manager/view_tree_host_impl.h b/services/ui/view_manager/view_tree_host_impl.h index 4c832f1..c364fe4 100644 --- a/services/ui/view_manager/view_tree_host_impl.h +++ b/services/ui/view_manager/view_tree_host_impl.h
@@ -28,8 +28,9 @@ void GetServiceProvider( mojo::InterfaceRequest<mojo::ServiceProvider> service_provider) override; void RequestLayout() override; - void SetRoot(uint32_t root_key, - mojo::ui::ViewOwnerPtr root_view_owner) override; + void SetRoot( + uint32_t root_key, + mojo::InterfaceHandle<mojo::ui::ViewOwner> root_view_owner) override; void ResetRoot(mojo::InterfaceRequest<mojo::ui::ViewOwner> transferred_view_owner_request) override; void LayoutRoot(mojo::ui::ViewLayoutParamsPtr root_layout_params,
diff --git a/shell/application_manager/application_manager.cc b/shell/application_manager/application_manager.cc index 11814b0..f5560e5 100644 --- a/shell/application_manager/application_manager.cc +++ b/shell/application_manager/application_manager.cc
@@ -128,7 +128,7 @@ const GURL& requested_url, const GURL& requestor_url, InterfaceRequest<ServiceProvider> services, - ServiceProviderPtr exposed_services, + mojo::InterfaceHandle<ServiceProvider> exposed_services, const base::Closure& on_application_end) { ConnectToApplicationWithParameters( requested_url, requestor_url, services.Pass(), exposed_services.Pass(), @@ -139,7 +139,7 @@ const GURL& requested_url, const GURL& requestor_url, InterfaceRequest<ServiceProvider> services, - ServiceProviderPtr exposed_services, + mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services, const base::Closure& on_application_end, const std::vector<std::string>& pre_redirect_parameters) { TRACE_EVENT_INSTANT2( @@ -243,7 +243,7 @@ const GURL& resolved_url, const GURL& requestor_url, InterfaceRequest<ServiceProvider>* services, - ServiceProviderPtr* exposed_services) { + mojo::InterfaceHandle<mojo::ServiceProvider>* exposed_services) { GURL application_url = GetBaseURLAndQuery(resolved_url, nullptr); ShellImpl* shell_impl = GetShellImpl(application_url); if (!shell_impl) @@ -261,7 +261,7 @@ const GURL& resolved_url, const GURL& requestor_url, InterfaceRequest<ServiceProvider>* services, - ServiceProviderPtr* exposed_services, + mojo::InterfaceHandle<mojo::ServiceProvider>* exposed_services, const base::Closure& on_application_end, const std::vector<std::string>& parameters, ApplicationLoader* loader) { @@ -292,7 +292,7 @@ const GURL& resolved_url, const GURL& requestor_url, InterfaceRequest<ServiceProvider> services, - ServiceProviderPtr exposed_services, + mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services, const base::Closure& on_application_end, const std::vector<std::string>& parameters) { Identity app_identity = MakeApplicationIdentity(resolved_url); @@ -325,7 +325,7 @@ const GURL& resolved_url, const GURL& requestor_url, InterfaceRequest<ServiceProvider> services, - ServiceProviderPtr exposed_services) { + mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services) { shell_impl->ConnectToClient(resolved_url, requestor_url, services.Pass(), exposed_services.Pass()); } @@ -333,7 +333,7 @@ void ApplicationManager::HandleFetchCallback( const GURL& requestor_url, InterfaceRequest<ServiceProvider> services, - ServiceProviderPtr exposed_services, + mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services, const base::Closure& on_application_end, const std::vector<std::string>& parameters, scoped_ptr<Fetcher> fetcher) {
diff --git a/shell/application_manager/application_manager.h b/shell/application_manager/application_manager.h index b577180..72cc947 100644 --- a/shell/application_manager/application_manager.h +++ b/shell/application_manager/application_manager.h
@@ -81,7 +81,7 @@ const GURL& application_url, const GURL& requestor_url, mojo::InterfaceRequest<mojo::ServiceProvider> services, - mojo::ServiceProviderPtr exposed_services, + mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services, const base::Closure& on_application_end); template <typename Interface> @@ -156,7 +156,7 @@ const GURL& application_url, const GURL& requestor_url, mojo::InterfaceRequest<mojo::ServiceProvider> services, - mojo::ServiceProviderPtr exposed_services, + mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services, const base::Closure& on_application_end, const std::vector<std::string>& pre_redirect_parameters); @@ -164,13 +164,13 @@ const GURL& resolved_url, const GURL& requestor_url, mojo::InterfaceRequest<mojo::ServiceProvider>* services, - mojo::ServiceProviderPtr* exposed_services); + mojo::InterfaceHandle<mojo::ServiceProvider>* exposed_services); bool ConnectToApplicationWithLoader( const GURL& resolved_url, const GURL& requestor_url, mojo::InterfaceRequest<mojo::ServiceProvider>* services, - mojo::ServiceProviderPtr* exposed_services, + mojo::InterfaceHandle<mojo::ServiceProvider>* exposed_services, const base::Closure& on_application_end, const std::vector<std::string>& parameters, ApplicationLoader* loader); @@ -188,22 +188,23 @@ const GURL& resolved_url, const GURL& requestor_url, mojo::InterfaceRequest<mojo::ServiceProvider> services, - mojo::ServiceProviderPtr exposed_services, + mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services, const base::Closure& on_application_end, const std::vector<std::string>& parameters); ShellImpl* GetShellImpl(const GURL& url); - void ConnectToClient(ShellImpl* shell_impl, - const GURL& resolved_url, - const GURL& requestor_url, - mojo::InterfaceRequest<mojo::ServiceProvider> services, - mojo::ServiceProviderPtr exposed_services); + void ConnectToClient( + ShellImpl* shell_impl, + const GURL& resolved_url, + const GURL& requestor_url, + mojo::InterfaceRequest<mojo::ServiceProvider> services, + mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services); void HandleFetchCallback( const GURL& requestor_url, mojo::InterfaceRequest<mojo::ServiceProvider> services, - mojo::ServiceProviderPtr exposed_services, + mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services, const base::Closure& on_application_end, const std::vector<std::string>& parameters, scoped_ptr<Fetcher> fetcher);
diff --git a/shell/application_manager/shell_impl.cc b/shell/application_manager/shell_impl.cc index a54adb5..b1c97c1 100644 --- a/shell/application_manager/shell_impl.cc +++ b/shell/application_manager/shell_impl.cc
@@ -14,6 +14,7 @@ using mojo::ApplicationPtr; using mojo::Array; using mojo::InterfaceRequest; +using mojo::InterfaceHandle; using mojo::ServiceProvider; using mojo::ServiceProviderPtr; using mojo::Shell; @@ -32,7 +33,7 @@ void ShellImpl::ApplicationConnectorImpl::ConnectToApplication( const String& app_url, InterfaceRequest<ServiceProvider> services, - ServiceProviderPtr exposed_services) { + InterfaceHandle<mojo::ServiceProvider> exposed_services) { shell_->ConnectToApplication(app_url, std::move(services), std::move(exposed_services)); } @@ -68,18 +69,20 @@ identity_.url.spec()); } -void ShellImpl::ConnectToClient(const GURL& requested_url, - const GURL& requestor_url, - InterfaceRequest<ServiceProvider> services, - ServiceProviderPtr exposed_services) { +void ShellImpl::ConnectToClient( + const GURL& requested_url, + const GURL& requestor_url, + InterfaceRequest<ServiceProvider> services, + InterfaceHandle<ServiceProvider> exposed_services) { application_->AcceptConnection( String::From(requestor_url), std::move(services), std::move(exposed_services), requested_url.spec()); } -void ShellImpl::ConnectToApplication(const String& app_url, - InterfaceRequest<ServiceProvider> services, - ServiceProviderPtr exposed_services) { +void ShellImpl::ConnectToApplication( + const String& app_url, + InterfaceRequest<ServiceProvider> services, + InterfaceHandle<mojo::ServiceProvider> exposed_services) { GURL app_gurl(app_url); if (!app_gurl.is_valid()) { LOG(ERROR) << "Error: invalid URL: " << app_url;
diff --git a/shell/application_manager/shell_impl.h b/shell/application_manager/shell_impl.h index 0fa93ca..c8af66b 100644 --- a/shell/application_manager/shell_impl.h +++ b/shell/application_manager/shell_impl.h
@@ -35,10 +35,11 @@ void InitializeApplication(mojo::Array<mojo::String> args); - void ConnectToClient(const GURL& requested_url, - const GURL& requestor_url, - mojo::InterfaceRequest<mojo::ServiceProvider> services, - mojo::ServiceProviderPtr exposed_services); + void ConnectToClient( + const GURL& requested_url, + const GURL& requestor_url, + mojo::InterfaceRequest<mojo::ServiceProvider> services, + mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services); mojo::Application* application() { return application_.get(); } const Identity& identity() const { return identity_; } @@ -54,7 +55,7 @@ void ConnectToApplication( const mojo::String& app_url, mojo::InterfaceRequest<mojo::ServiceProvider> services, - mojo::ServiceProviderPtr exposed_services) override; + mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services) override; void Duplicate(mojo::InterfaceRequest<mojo::ApplicationConnector> application_connector_request) override; @@ -69,7 +70,7 @@ void ConnectToApplication( const mojo::String& app_url, mojo::InterfaceRequest<mojo::ServiceProvider> services, - mojo::ServiceProviderPtr exposed_services) override; + mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services) override; void CreateApplicationConnector( mojo::InterfaceRequest<mojo::ApplicationConnector> application_connector_request) override;
diff --git a/shell/crash/crash_upload_unittests.cc b/shell/crash/crash_upload_unittests.cc index f50e7bd..ce580f8 100644 --- a/shell/crash/crash_upload_unittests.cc +++ b/shell/crash/crash_upload_unittests.cc
@@ -78,11 +78,13 @@ const CreateTCPConnectedSocketCallback& callback) override {} void CreateUDPSocket( mojo::InterfaceRequest<mojo::UDPSocket> socket) override {} - void CreateHttpServer(mojo::NetAddressPtr local_address, - mojo::HttpServerDelegatePtr delegate, - const CreateHttpServerCallback& callback) override {} + void CreateHttpServer( + mojo::NetAddressPtr local_address, + mojo::InterfaceHandle<mojo::HttpServerDelegate> delegate, + const CreateHttpServerCallback& callback) override {} void RegisterURLLoaderInterceptor( - mojo::URLLoaderInterceptorFactoryPtr factory) override {} + mojo::InterfaceHandle<mojo::URLLoaderInterceptorFactory> factory) + override {} void CreateHostResolver( mojo::InterfaceRequest<mojo::HostResolver> host_resolver) override {}