Commit a33a9505 authored by Johann Koenig's avatar Johann Koenig Committed by Commit Bot

Revert "presentation controller: remove execution context"

This reverts commit ffcf2b75.

Reason for revert: Surprising impact to system_health.memory_desktop

Bug: 1068911

Original change's description:
> presentation controller: remove execution context
> 
> The PresentationController class does not need
> ExecutionContextLifecycleObserver since the mojo::Receiver was migrated
> to HeapMojoReceiver. The replacement wrapper includes management of the
> presentation_controller_receiver_.
> 
> Change-Id: I1c96f897a7b604a23d3e7f0bd61a3b0598faa2f8
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2137162
> Commit-Queue: Johann Koenig <johannkoenig@google.com>
> Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
> Reviewed-by: Mounir Lamouri <mlamouri@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#756871}

TBR=kouhei@chromium.org,mlamouri@chromium.org,johannkoenig@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I46cdb9285cf604eb41b38ac6cc8d7fcec1f10430
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2141996Reviewed-by: default avatarJohann Koenig <johannkoenig@google.com>
Reviewed-by: default avatarKouhei Ueno <kouhei@chromium.org>
Commit-Queue: Johann Koenig <johannkoenig@google.com>
Cr-Commit-Position: refs/heads/master@{#757408}
parent b6faddb0
...@@ -240,7 +240,7 @@ ControllerPresentationConnection* ControllerPresentationConnection::Take( ...@@ -240,7 +240,7 @@ ControllerPresentationConnection* ControllerPresentationConnection::Take(
DCHECK(request); DCHECK(request);
auto* connection = MakeGarbageCollected<ControllerPresentationConnection>( auto* connection = MakeGarbageCollected<ControllerPresentationConnection>(
*controller->GetSupplementable(), controller, presentation_info.id, *controller->GetFrame(), controller, presentation_info.id,
presentation_info.url); presentation_info.url);
controller->RegisterConnection(connection); controller->RegisterConnection(connection);
......
...@@ -22,6 +22,7 @@ namespace blink { ...@@ -22,6 +22,7 @@ namespace blink {
PresentationController::PresentationController(LocalFrame& frame) PresentationController::PresentationController(LocalFrame& frame)
: Supplement<LocalFrame>(frame), : Supplement<LocalFrame>(frame),
ExecutionContextLifecycleObserver(frame.GetDocument()),
presentation_controller_receiver_(this, frame.DomWindow()) {} presentation_controller_receiver_(this, frame.DomWindow()) {}
PresentationController::~PresentationController() = default; PresentationController::~PresentationController() = default;
...@@ -59,6 +60,7 @@ void PresentationController::Trace(Visitor* visitor) { ...@@ -59,6 +60,7 @@ void PresentationController::Trace(Visitor* visitor) {
visitor->Trace(connections_); visitor->Trace(connections_);
visitor->Trace(availability_state_); visitor->Trace(availability_state_);
Supplement<LocalFrame>::Trace(visitor); Supplement<LocalFrame>::Trace(visitor);
ExecutionContextLifecycleObserver::Trace(visitor);
} }
void PresentationController::SetPresentation(Presentation* presentation) { void PresentationController::SetPresentation(Presentation* presentation) {
...@@ -151,10 +153,10 @@ PresentationController::FindExistingConnection( ...@@ -151,10 +153,10 @@ PresentationController::FindExistingConnection(
mojo::Remote<mojom::blink::PresentationService>& mojo::Remote<mojom::blink::PresentationService>&
PresentationController::GetPresentationService() { PresentationController::GetPresentationService() {
if (!presentation_service_remote_ && GetSupplementable()) { if (!presentation_service_remote_ && GetFrame()) {
scoped_refptr<base::SingleThreadTaskRunner> task_runner = scoped_refptr<base::SingleThreadTaskRunner> task_runner =
GetSupplementable()->GetTaskRunner(TaskType::kPresentation); GetFrame()->GetTaskRunner(TaskType::kPresentation);
GetSupplementable()->GetBrowserInterfaceBroker().GetInterface( GetFrame()->GetBrowserInterfaceBroker().GetInterface(
presentation_service_remote_.BindNewPipeAndPassReceiver(task_runner)); presentation_service_remote_.BindNewPipeAndPassReceiver(task_runner));
presentation_service_remote_->SetController( presentation_service_remote_->SetController(
presentation_controller_receiver_.BindNewPipeAndPassRemote( presentation_controller_receiver_.BindNewPipeAndPassRemote(
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base/macros.h" #include "base/macros.h"
#include "mojo/public/cpp/bindings/remote.h" #include "mojo/public/cpp/bindings/remote.h"
#include "third_party/blink/public/mojom/presentation/presentation.mojom-blink.h" #include "third_party/blink/public/mojom/presentation/presentation.mojom-blink.h"
#include "third_party/blink/renderer/core/execution_context/execution_context_lifecycle_observer.h"
#include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/local_frame_client.h" #include "third_party/blink/renderer/core/frame/local_frame_client.h"
#include "third_party/blink/renderer/modules/modules_export.h" #include "third_party/blink/renderer/modules/modules_export.h"
...@@ -30,6 +31,7 @@ class PresentationAvailabilityState; ...@@ -30,6 +31,7 @@ class PresentationAvailabilityState;
class MODULES_EXPORT PresentationController class MODULES_EXPORT PresentationController
: public GarbageCollected<PresentationController>, : public GarbageCollected<PresentationController>,
public Supplement<LocalFrame>, public Supplement<LocalFrame>,
public ExecutionContextLifecycleObserver,
public mojom::blink::PresentationController { public mojom::blink::PresentationController {
USING_GARBAGE_COLLECTED_MIXIN(PresentationController); USING_GARBAGE_COLLECTED_MIXIN(PresentationController);
...@@ -77,6 +79,9 @@ class MODULES_EXPORT PresentationController ...@@ -77,6 +79,9 @@ class MODULES_EXPORT PresentationController
virtual void RemoveAvailabilityObserver(PresentationAvailabilityObserver*); virtual void RemoveAvailabilityObserver(PresentationAvailabilityObserver*);
private: private:
// Implementation of ExecutionContextLifecycleObserver.
void ContextDestroyed() override {}
// mojom::blink::PresentationController implementation. // mojom::blink::PresentationController implementation.
void OnScreenAvailabilityUpdated(const KURL&, void OnScreenAvailabilityUpdated(const KURL&,
mojom::blink::ScreenAvailability) override; mojom::blink::ScreenAvailability) override;
......
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