0

Reland "presentation controller: remove execution context"

This is a reland of ffcf2b75bc. It was
reverted in a33a9505cf due to an alert
triggering for heap allocations. After discussion it sounds like
this was the straw the forced the camel to allocate a new page and
had an outsize impact on heap size.

Fixed: chromium: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}

Change-Id: I5270d6ca2483aa2815aaea59cacb2a8f627e5595
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2142876
Reviewed-by: Mounir Lamouri <mlamouri@chromium.org>
Commit-Queue: Johann Koenig <johannkoenig@google.com>
Cr-Commit-Position: refs/heads/master@{#758068}
This commit is contained in:
Johann
2020-04-09 23:21:40 +00:00
committed by Commit Bot
parent f623278ed2
commit cae5fb2087
3 changed files with 4 additions and 11 deletions

@ -240,7 +240,7 @@ ControllerPresentationConnection* ControllerPresentationConnection::Take(
DCHECK(request);
auto* connection = MakeGarbageCollected<ControllerPresentationConnection>(
*controller->GetFrame(), controller, presentation_info.id,
*controller->GetSupplementable(), controller, presentation_info.id,
presentation_info.url);
controller->RegisterConnection(connection);

@ -22,7 +22,6 @@ namespace blink {
PresentationController::PresentationController(LocalFrame& frame)
: Supplement<LocalFrame>(frame),
ExecutionContextLifecycleObserver(frame.GetDocument()),
presentation_controller_receiver_(this, frame.DomWindow()) {}
PresentationController::~PresentationController() = default;
@ -60,7 +59,6 @@ void PresentationController::Trace(Visitor* visitor) {
visitor->Trace(connections_);
visitor->Trace(availability_state_);
Supplement<LocalFrame>::Trace(visitor);
ExecutionContextLifecycleObserver::Trace(visitor);
}
void PresentationController::SetPresentation(Presentation* presentation) {
@ -153,10 +151,10 @@ PresentationController::FindExistingConnection(
mojo::Remote<mojom::blink::PresentationService>&
PresentationController::GetPresentationService() {
if (!presentation_service_remote_ && GetFrame()) {
if (!presentation_service_remote_ && GetSupplementable()) {
scoped_refptr<base::SingleThreadTaskRunner> task_runner =
GetFrame()->GetTaskRunner(TaskType::kPresentation);
GetFrame()->GetBrowserInterfaceBroker().GetInterface(
GetSupplementable()->GetTaskRunner(TaskType::kPresentation);
GetSupplementable()->GetBrowserInterfaceBroker().GetInterface(
presentation_service_remote_.BindNewPipeAndPassReceiver(task_runner));
presentation_service_remote_->SetController(
presentation_controller_receiver_.BindNewPipeAndPassRemote(

@ -8,7 +8,6 @@
#include "base/macros.h"
#include "mojo/public/cpp/bindings/remote.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_client.h"
#include "third_party/blink/renderer/modules/modules_export.h"
@ -31,7 +30,6 @@ class PresentationAvailabilityState;
class MODULES_EXPORT PresentationController
: public GarbageCollected<PresentationController>,
public Supplement<LocalFrame>,
public ExecutionContextLifecycleObserver,
public mojom::blink::PresentationController {
USING_GARBAGE_COLLECTED_MIXIN(PresentationController);
@ -79,9 +77,6 @@ class MODULES_EXPORT PresentationController
virtual void RemoveAvailabilityObserver(PresentationAvailabilityObserver*);
private:
// Implementation of ExecutionContextLifecycleObserver.
void ContextDestroyed() override {}
// mojom::blink::PresentationController implementation.
void OnScreenAvailabilityUpdated(const KURL&,
mojom::blink::ScreenAvailability) override;