Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(498)

Unified Diff: components/memory_pressure/filtered_memory_pressure_calculator.h

Issue 1317353006: Make FilteredMemoryPressureCalculator injected dependencies externally owned. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@stats
Patch Set: Addressed nit. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/memory_pressure/filtered_memory_pressure_calculator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/memory_pressure/filtered_memory_pressure_calculator.h
diff --git a/components/memory_pressure/filtered_memory_pressure_calculator.h b/components/memory_pressure/filtered_memory_pressure_calculator.h
index b49fed75dfa303acaa7bef3035ec9e1d6ac999be..38890f07f4629ba4bfee06148bd1e839442a2a91 100644
--- a/components/memory_pressure/filtered_memory_pressure_calculator.h
+++ b/components/memory_pressure/filtered_memory_pressure_calculator.h
@@ -5,9 +5,14 @@
#ifndef COMPONENTS_MEMORY_PRESSURE_FILTERED_MEMORY_PRESSURE_CALCULATOR_H_
#define COMPONENTS_MEMORY_PRESSURE_FILTERED_MEMORY_PRESSURE_CALCULATOR_H_
-#include "base/time/tick_clock.h"
#include "components/memory_pressure/memory_pressure_calculator.h"
+#include "base/time/time.h"
+
+namespace base {
+class TickClock;
+} // namespace base
+
namespace memory_pressure {
#if defined(MEMORY_PRESSURE_IS_POLLING)
@@ -26,18 +31,16 @@ class FilteredMemoryPressureCalculator : public MemoryPressureCalculator {
static const int kCriticalPressureCooldownPeriodMs;
static const int kModeratePressureCooldownPeriodMs;
- explicit FilteredMemoryPressureCalculator(
- scoped_ptr<MemoryPressureCalculator> pressure_calculator);
+ // The provided |pressure_calculator| and |tick_clock| must outlive this
+ // object.
+ FilteredMemoryPressureCalculator(
+ MemoryPressureCalculator* pressure_calculator,
+ base::TickClock* tick_clock);
~FilteredMemoryPressureCalculator() override;
// Calculates the current pressure level.
MemoryPressureLevel CalculateCurrentPressureLevel() override;
- // Testing seam for configuring the tick clock in use.
- void set_tick_clock(scoped_ptr<base::TickClock> tick_clock) {
- tick_clock_ = tick_clock.Pass();
- }
-
// Accessors for unittesting.
bool cooldown_in_progress() const { return cooldown_in_progress_; }
base::TimeTicks cooldown_start_time() const { return cooldown_start_time_; }
@@ -46,11 +49,11 @@ class FilteredMemoryPressureCalculator : public MemoryPressureCalculator {
private:
friend class TestFilteredMemoryPressureCalculator;
- // The delegate tick clock. This is settable as a testing seam.
- scoped_ptr<base::TickClock> tick_clock_;
-
// The delegate pressure calculator. Provided by the constructor.
- scoped_ptr<MemoryPressureCalculator> pressure_calculator_;
+ MemoryPressureCalculator* pressure_calculator_;
+
+ // The delegate tick clock. Provided by the constructor.
+ base::TickClock* tick_clock_;
// The memory pressure currently being reported.
MemoryPressureLevel current_pressure_level_;
« no previous file with comments | « no previous file | components/memory_pressure/filtered_memory_pressure_calculator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698