Mojo JS Bindings: Revised bindings for Mojo interface parameters

Revised Interface Parameter Bindings Usage

-- In General

From a user's point of view, the bindings are in terms of the (remote)
proxy class and the (local) stub class's implementation delegate
(internally, that's the stub class's delegate$ property).  The
bindings will add/use a local$ property on proxy objects. The local$
property is the value of the stub class's implementation delegate.
They also manage a remote$property on the implementation delegate whose
value is the proxy.

All of that implies:

fooImpl.remote$.local$ == fooImpl (the stub class's delegate)
fooProxy.local$.remote$ == fooProxy

The caller and callee use cases that follow are  in terms of the
following mojom:

  [Client=Bar]
  interface Foo {
  }

  [Client=Foo] // Redundant but always implicitly true.
  interface Bar {
  }

  interface I {
    provideFoo(Foo foo);
    requestFoo(Foo& foo); // effectively: provideFoo(Bar bar)
  }

-- Callers

Assuming that we have a proxy for interface I, iProxy.

An iProxy.provideFoo() call implies that we have an implementation of
Foo, and want a proxy for Bar (Foo's client).

  var myFooImpl;
  provideFoo(myFooImpl);
  myFooImpl.remote$; // A Bar proxy initialized by provideFoo(),
                     // undefined if Foo has no client.

An iProxy.requestFoo() call implies that we have an implementation of
Bar and want a proxy for Foo (Bar's client).

  var myBarImpl; // If Foo has no client then this is just {}.
  requestFoo(myBarImpl);
  myBarImpl.remote$; // A Foo proxy initialized by requestFoo.

-- Callees

An implementation of provideFoo(Foo foo) implies that we have an
implementation of Bar (Foo's client) and want a proxy to the Foo
that has been passed to us.

  void provideFoo(fooProxy) {
    fooProxy.local$ = myBarImpl; // sets myFooImpl.remote$ = fooProxy
  }

An implementation of requestFoo(Foo& foo) implies that we have an
implementation of Foo and want a proxy for the Bar (Foo's client)
that's been passed to us.

  void requestFoo(barProxy) {
    barProxy.local$ = myFooImpl; // sets myFooImpl.remote$ = barProxy
  }

BUG=
R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/812243002