Commit 3c285564 authored by Johann's avatar Johann Committed by Commit Bot

heap mojo: migrate GampadDispatcher gamepad_haptics_manager_remote_

Use the HeapMojoRemote wrapper so that Oilpan will GC the object.

BUG=chromium:1049056

Change-Id: I387365fe5a52180547aa8c1728bc3b6c31cffcc8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2147975
Commit-Queue: Johann Koenig <johannkoenig@google.com>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarKouhei Ueno <kouhei@chromium.org>
Cr-Commit-Position: refs/heads/master@{#762737}
parent 9dac34a8
......@@ -43,12 +43,13 @@ void GamepadDispatcher::ResetVibrationActuator(
GamepadDispatcher::GamepadDispatcher(ExecutionContext* context)
: // See https://bit.ly/2S0zRAS for task types.
task_runner_(context ? context->GetTaskRunner(TaskType::kMiscPlatformAPI)
: nullptr) {}
: nullptr),
gamepad_haptics_manager_remote_(context) {}
GamepadDispatcher::~GamepadDispatcher() = default;
void GamepadDispatcher::InitializeHaptics() {
if (!gamepad_haptics_manager_remote_) {
if (!gamepad_haptics_manager_remote_.is_bound()) {
Platform::Current()->GetBrowserInterfaceBroker()->GetInterface(
gamepad_haptics_manager_remote_.BindNewPipeAndPassReceiver(
task_runner_));
......@@ -57,6 +58,7 @@ void GamepadDispatcher::InitializeHaptics() {
void GamepadDispatcher::Trace(Visitor* visitor) {
visitor->Trace(reader_);
visitor->Trace(gamepad_haptics_manager_remote_);
PlatformEventDispatcher::Trace(visitor);
}
......
......@@ -9,10 +9,11 @@
#include "base/memory/scoped_refptr.h"
#include "device/gamepad/public/mojom/gamepad.mojom-blink.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/frame/platform_event_dispatcher.h"
#include "third_party/blink/renderer/modules/gamepad/gamepad_listener.h"
#include "third_party/blink/renderer/platform/mojo/heap_mojo_remote.h"
#include "third_party/blink/renderer/platform/mojo/heap_mojo_wrapper_mode.h"
namespace device {
class Gamepad;
......@@ -63,7 +64,8 @@ class GamepadDispatcher final : public GarbageCollected<GamepadDispatcher>,
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
Member<GamepadSharedMemoryReader> reader_;
mojo::Remote<device::mojom::blink::GamepadHapticsManager>
HeapMojoRemote<device::mojom::blink::GamepadHapticsManager,
HeapMojoWrapperMode::kWithoutContextObserver>
gamepad_haptics_manager_remote_;
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment