diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-09 22:35:51 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-09 22:35:51 +0000 |
commit | 5e1a832c8186ef29546b6b60f90d7974ca72d3c9 (patch) | |
tree | 41b3fd3eaf316e7353a566c2b8923566788dd446 /mojo/examples/pepper_container_app/pepper_container_app.cc | |
parent | 92028f1406eeb252247b55b8db63b1b8cdf69945 (diff) | |
download | chromium_src-5e1a832c8186ef29546b6b60f90d7974ca72d3c9.zip chromium_src-5e1a832c8186ef29546b6b60f90d7974ca72d3c9.tar.gz chromium_src-5e1a832c8186ef29546b6b60f90d7974ca72d3c9.tar.bz2 |
Mojo: Replace RemotePtr with InterfacePtr and InterfaceImpl
Interfaces no longer have explicit Peer attributes. An interface may now optionally have a Client interface, in which case a SetClient method will be auto-generated.
InterfacePtr is a proxy to a remote instance of an interface. InterfaceImpl is a base class used when implementing an interface. Both have facilities for binding to a pipe, etc. An InterfacePtr is movable but not copyable and looks a lot like RemotePtr save for how it gets initialized (via the Bind method now).
I've added some new top-level functions:
MakeProxy - makes it easy to initialize an InterfacePtr in say a member initializer list.
BindToPipe - this is how you bind an InterfaceImpl to a pipe. once bound, they cannot be unbound until the object is destroyed or the pipe is closed.
BindToProxy - builds on top of BindToPipe, however, it hides the details of the pipe. What you get back is an InterfacePtr.
Generated C++ code now passes InterfacePtr instead of InterfaceHandle. As a result, we have far less need for typed subclasses of MessagePipeHandle, so I eliminated them. The code that needs to deal with raw handles generally has to deal with {Scoped}MessagePipeHandle, and adding strong typing to these handles doesn't seem helpful anymore.
R=davemoore@chromium.org
Review URL: https://codereview.chromium.org/265793015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269443 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo/examples/pepper_container_app/pepper_container_app.cc')
-rw-r--r-- | mojo/examples/pepper_container_app/pepper_container_app.cc | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/mojo/examples/pepper_container_app/pepper_container_app.cc b/mojo/examples/pepper_container_app/pepper_container_app.cc index 4100507..db2fad4 100644 --- a/mojo/examples/pepper_container_app/pepper_container_app.cc +++ b/mojo/examples/pepper_container_app/pepper_container_app.cc @@ -12,7 +12,6 @@ #include "mojo/examples/pepper_container_app/plugin_module.h" #include "mojo/examples/pepper_container_app/type_converters.h" #include "mojo/public/cpp/bindings/allocation_scope.h" -#include "mojo/public/cpp/bindings/remote_ptr.h" #include "mojo/public/cpp/environment/environment.h" #include "mojo/public/cpp/gles2/gles2.h" #include "mojo/public/cpp/shell/application.h" @@ -43,11 +42,11 @@ class PepperContainerApp: public Application, : Application(shell_handle), ppapi_globals_(this), plugin_module_(new PluginModule) { - InterfacePipe<NativeViewport, AnyInterface> viewport_pipe; mojo::AllocationScope scope; - shell()->Connect("mojo:mojo_native_viewport_service", - viewport_pipe.handle_to_peer.Pass()); - viewport_.reset(viewport_pipe.handle_to_self.Pass(), this); + + ConnectTo("mojo:mojo_native_viewport_service", &viewport_); + viewport_->SetClient(this); + Rect::Builder rect; Point::Builder point; point.set_x(10); @@ -110,7 +109,7 @@ class PepperContainerApp: public Application, private: MojoPpapiGlobals ppapi_globals_; - RemotePtr<NativeViewport> viewport_; + NativeViewportPtr viewport_; scoped_refptr<PluginModule> plugin_module_; scoped_ptr<PluginInstance> plugin_instance_; |