Commit 11261624 authored by Francois Doray's avatar Francois Doray Committed by Commit Bot

Add default implementations for LifecycleUnitObserver methods.

These will be useful for an upcoming CL were TabManager doesn't need
to have its own implementation of all methods.

Bug: 775644
Change-Id: Id746ab0fbf821cc7c20be731c3e84950ae470631
Reviewed-on: https://chromium-review.googlesource.com/981263Reviewed-by: default avatarSébastien Marchand <sebmarchand@chromium.org>
Commit-Queue: François Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/master@{#547149}
parent 3c36f247
......@@ -2617,6 +2617,7 @@ jumbo_split_static_library("browser") {
"resource_coordinator/lifecycle_unit.h",
"resource_coordinator/lifecycle_unit_base.cc",
"resource_coordinator/lifecycle_unit_base.h",
"resource_coordinator/lifecycle_unit_observer.cc",
"resource_coordinator/lifecycle_unit_observer.h",
"resource_coordinator/lifecycle_unit_source.h",
"resource_coordinator/lifecycle_unit_source_base.cc",
......
......@@ -25,10 +25,6 @@ void DiscardMetricsLifecycleUnitObserver::OnLifecycleUnitStateChanged(
OnReload();
}
void DiscardMetricsLifecycleUnitObserver::OnLifecycleUnitVisibilityChanged(
LifecycleUnit* lifecycle_unit,
content::Visibility visibility) {}
void DiscardMetricsLifecycleUnitObserver::OnLifecycleUnitDestroyed(
LifecycleUnit* lifecycle_unit) {
// If the browser is not shutting down and the tab is in a LOADED state after
......
......@@ -20,9 +20,6 @@ class DiscardMetricsLifecycleUnitObserver : public LifecycleUnitObserver {
// LifecycleUnitObserver:
void OnLifecycleUnitStateChanged(LifecycleUnit* lifecycle_unit) override;
void OnLifecycleUnitVisibilityChanged(
LifecycleUnit* lifecycle_unit,
content::Visibility visibility) override;
void OnLifecycleUnitDestroyed(LifecycleUnit* lifecycle_unit) override;
private:
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/resource_coordinator/lifecycle_unit_observer.h"
namespace resource_coordinator {
LifecycleUnitObserver::~LifecycleUnitObserver() = default;
void LifecycleUnitObserver::OnLifecycleUnitStateChanged(
LifecycleUnit* lifecycle_unit) {}
void LifecycleUnitObserver::OnLifecycleUnitVisibilityChanged(
LifecycleUnit* lifecycle_unit,
content::Visibility visibility) {}
void LifecycleUnitObserver::OnLifecycleUnitDestroyed(
LifecycleUnit* lifecycle_unit) {}
} // namespace resource_coordinator
......@@ -14,19 +14,18 @@ class LifecycleUnit;
// Interface to be notified when the state of a LifecycleUnit changes.
class LifecycleUnitObserver {
public:
virtual ~LifecycleUnitObserver() = default;
virtual ~LifecycleUnitObserver();
// Invoked when the state of the observed LifecycleUnit changes.
virtual void OnLifecycleUnitStateChanged(LifecycleUnit* lifecycle_unit) = 0;
virtual void OnLifecycleUnitStateChanged(LifecycleUnit* lifecycle_unit);
// Invoked when the visibility of the observed LifecyleUnit changes.
virtual void OnLifecycleUnitVisibilityChanged(
LifecycleUnit* lifecycle_unit,
content::Visibility visibility) = 0;
virtual void OnLifecycleUnitVisibilityChanged(LifecycleUnit* lifecycle_unit,
content::Visibility visibility);
// Invoked before the observed LifecycleUnit starts being destroyed (i.e.
// |lifecycle_unit| is still valid when this is invoked).
virtual void OnLifecycleUnitDestroyed(LifecycleUnit* lifecycle_unit) = 0;
virtual void OnLifecycleUnitDestroyed(LifecycleUnit* lifecycle_unit);
};
} // namespace resource_coordinator
......
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