New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 654218 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
please use my google.com address
Closed: Oct 2016
Cc:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Allow mojo binding primitives to use arbitrary reference types to point to impls

Project Member Reported by roc...@chromium.org, Oct 8 2016

Issue description

All bindings primitives today use a raw pointer to point at their target impl. If this were customizable we could support bindings with weak ptrs and such.

This is particularly useful in blink where it's common for an impl to be a GCed object. Today this means all such impls need a pre-finalizer to explicitly close the binding and avoid dispatch. They could instead use a binding which holds a WeakPersistent.
 
Project Member

Comment 1 by bugdroid1@chromium.org, Oct 10 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/8e2a5d2996da6336f3c817eda73da12c7a3c7d84

commit 8e2a5d2996da6336f3c817eda73da12c7a3c7d84
Author: rockot <rockot@chromium.org>
Date: Mon Oct 10 06:38:10 2016

Mojo C++ Bindings: Support custom impl ref types

Allows binding primitives to use custom reference types
for their interface implementation.

BUG= 654218 

Review-Url: https://codereview.chromium.org/2403533003
Cr-Commit-Position: refs/heads/master@{#424118}

[modify] https://crrev.com/8e2a5d2996da6336f3c817eda73da12c7a3c7d84/mojo/public/cpp/bindings/associated_binding.h
[modify] https://crrev.com/8e2a5d2996da6336f3c817eda73da12c7a3c7d84/mojo/public/cpp/bindings/binding.h
[modify] https://crrev.com/8e2a5d2996da6336f3c817eda73da12c7a3c7d84/mojo/public/cpp/bindings/lib/binding_state.h
[add] https://crrev.com/8e2a5d2996da6336f3c817eda73da12c7a3c7d84/mojo/public/cpp/bindings/raw_ptr_impl_ref_traits.h
[modify] https://crrev.com/8e2a5d2996da6336f3c817eda73da12c7a3c7d84/mojo/public/cpp/bindings/tests/binding_unittest.cc
[modify] https://crrev.com/8e2a5d2996da6336f3c817eda73da12c7a3c7d84/mojo/public/cpp/bindings/tests/sample_service_unittest.cc
[modify] https://crrev.com/8e2a5d2996da6336f3c817eda73da12c7a3c7d84/mojo/public/tools/bindings/generators/cpp_templates/interface_declaration.tmpl
[modify] https://crrev.com/8e2a5d2996da6336f3c817eda73da12c7a3c7d84/mojo/public/tools/bindings/generators/cpp_templates/interface_definition.tmpl
[modify] https://crrev.com/8e2a5d2996da6336f3c817eda73da12c7a3c7d84/mojo/public/tools/bindings/generators/cpp_templates/interface_stub_declaration.tmpl
[modify] https://crrev.com/8e2a5d2996da6336f3c817eda73da12c7a3c7d84/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl

Comment 2 by roc...@chromium.org, Oct 10 2016

Status: Fixed (was: Assigned)
Does this mean that we no longer need to use a pre-finalizer for Mojo Bindings?

Comment 4 by roc...@chromium.org, Oct 10 2016

Yes, you should be able to implement traits for WeakPersistent and use them. See the unit test in the CL for an example of this with base::WeakPtr.

Sign in to add a comment