diff options
Diffstat (limited to 'chromium/third_party/blink/renderer/platform/mojo/heap_mojo_remote.h')
-rw-r--r-- | chromium/third_party/blink/renderer/platform/mojo/heap_mojo_remote.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/chromium/third_party/blink/renderer/platform/mojo/heap_mojo_remote.h b/chromium/third_party/blink/renderer/platform/mojo/heap_mojo_remote.h index d5bd21207df..5fce5c8a6b9 100644 --- a/chromium/third_party/blink/renderer/platform/mojo/heap_mojo_remote.h +++ b/chromium/third_party/blink/renderer/platform/mojo/heap_mojo_remote.h @@ -10,6 +10,7 @@ #include "mojo/public/cpp/bindings/remote.h" #include "third_party/blink/renderer/platform/context_lifecycle_observer.h" #include "third_party/blink/renderer/platform/heap/heap.h" +#include "third_party/blink/renderer/platform/mojo/features.h" #include "third_party/blink/renderer/platform/mojo/heap_mojo_wrapper_mode.h" namespace blink { @@ -18,8 +19,8 @@ namespace blink { // garbage-collected object. Blink is expected to use HeapMojoRemote by // default. HeapMojoRemote must be associated with context. // HeapMojoRemote's constructor takes context as a mandatory parameter. -// HeapMojoRemote resets the mojo connection when 1) the owner object is -// garbage-collected and 2) the associated ExecutionContext is detached. +// HeapMojoRemote resets the mojo connection when the associated +// ExecutionContext is detached. // TODO(crbug.com/1058076) HeapMojoWrapperMode should be removed once we ensure // that the interface is not used after ContextDestroyed(). @@ -70,13 +71,12 @@ class HeapMojoRemote { mojo::PendingFlush FlushAsync() { return wrapper_->remote().FlushAsync(); } void FlushForTesting() { return wrapper_->remote().FlushForTesting(); } - void Trace(Visitor* visitor) { visitor->Trace(wrapper_); } + void Trace(Visitor* visitor) const { visitor->Trace(wrapper_); } private: - // Garbage collected wrapper class to add a prefinalizer. + // Garbage collected wrapper class to add ContextLifecycleObserver. class Wrapper final : public GarbageCollected<Wrapper>, public ContextLifecycleObserver { - USING_PRE_FINALIZER(Wrapper, Dispose); USING_GARBAGE_COLLECTED_MIXIN(Wrapper); public: @@ -88,17 +88,17 @@ class HeapMojoRemote { Wrapper(Wrapper&&) = default; Wrapper& operator=(Wrapper&&) = default; - void Trace(Visitor* visitor) override { + void Trace(Visitor* visitor) const override { ContextLifecycleObserver::Trace(visitor); } - void Dispose() { remote_.reset(); } - mojo::Remote<Interface>& remote() { return remote_; } // ContextLifecycleObserver methods void ContextDestroyed() override { - if (Mode == HeapMojoWrapperMode::kWithContextObserver) + if (Mode == HeapMojoWrapperMode::kWithContextObserver || + (Mode == HeapMojoWrapperMode::kWithoutContextObserver && + base::FeatureList::IsEnabled(kHeapMojoUseContextObserver))) remote_.reset(); } |