Remove deprecated setupMemoryManagement methods

This commit is contained in:
Gwendal Roué committed 2020-03-08 16:08:12 +01:00
1 parent 130e510f8c
commit bfdd0696da
3 files changed
+24 -19

No files matched your search

+3 -10
View File
@@ -135,12 +135,12 @@ public final class DatabasePool: DatabaseWriter {
// Be a nice iOS citizen, and don't consume too much memory
// See https://github.com/groue/GRDB.swift/#memory-management
#if os(iOS)
setupAutomaticMemoryManagement()
setupMemoryManagement()
#endif
}
deinit {
// Undo job done in setupAutomaticMemoryManagement()
// Undo job done in setupMemoryManagement()
//
// https://developer.apple.com/library/mac/releasenotes/Foundation/RN-Foundation/index.html#10_11Error
// Explicit unregistration is required before iOS 9 and OS X 10.11.
@@ -202,14 +202,7 @@ extension DatabasePool {
}
}
#if os(iOS)
// swiftlint:disable:next line_length
@available(*, deprecated, message: "Memory management is now enabled by default. This deprecated method does nothing.")
public func setupMemoryManagement(in application: UIApplication) {
// No op.
}
/// Listens to UIApplicationDidEnterBackgroundNotification and
/// UIApplicationDidReceiveMemoryWarningNotification in order to release
/// as much memory as possible.
@@ -217,7 +210,7 @@ extension DatabasePool {
/// - param application: The UIApplication that will start a background
/// task to let the database pool release its memory when the application
/// enters background.
private func setupAutomaticMemoryManagement() {
private func setupMemoryManagement() {
let center = NotificationCenter.default
center.addObserver(
self,
+3 -9
View File
@@ -44,7 +44,7 @@ public final class DatabaseQueue: DatabaseWriter {
// Be a nice iOS citizen, and don't consume too much memory
// See https://github.com/groue/GRDB.swift/#memory-management
#if os(iOS)
setupAutomaticMemoryManagement()
setupMemoryManagement()
#endif
}
@@ -65,7 +65,7 @@ public final class DatabaseQueue: DatabaseWriter {
}
deinit {
// Undo job done in setupAutomaticMemoryManagement()
// Undo job done in setupMemoryManagement()
//
// https://developer.apple.com/library/mac/releasenotes/Foundation/RN-Foundation/index.html#10_11Error
// Explicit unregistration is required before iOS 9 and OS X 10.11.
@@ -85,12 +85,6 @@ extension DatabaseQueue {
}
#if os(iOS)
// swiftlint:disable:next line_length
@available(*, deprecated, message: "Memory management is now enabled by default. This deprecated method does nothing.")
public func setupMemoryManagement(in application: UIApplication) {
// No op.
}
/// Listens to UIApplicationDidEnterBackgroundNotification and
/// UIApplicationDidReceiveMemoryWarningNotification in order to release
/// as much memory as possible.
@@ -98,7 +92,7 @@ extension DatabaseQueue {
/// - param application: The UIApplication that will start a background
/// task to let the database queue release its memory when the application
/// enters background.
private func setupAutomaticMemoryManagement() {
private func setupMemoryManagement() {
let center = NotificationCenter.default
center.addObserver(
self,
+18
View File
@@ -1,5 +1,9 @@
// Fixits for changes introduced by GRDB 5.0.0
#if os(iOS)
import UIKit
#endif
#if SQLITE_HAS_CODEC
extension Configuration {
@available(*, unavailable, message: "Use Database.usePassphrase(_:) in Configuration.prepareDatabase instead.")
@@ -19,3 +23,17 @@ extension DatabaseQueue {
public func change(passphrase: String) throws { preconditionFailure() }
}
#endif
extension DatabasePool {
#if os(iOS)
@available(*, unavailable, message: "Memory management is now enabled by default. This method does nothing.")
public func setupMemoryManagement(in application: UIApplication) { preconditionFailure() }
#endif
}
extension DatabaseQueue {
#if os(iOS)
@available(*, unavailable, message: "Memory management is now enabled by default. This method does nothing.")
public func setupMemoryManagement(in application: UIApplication) { preconditionFailure() }
#endif
}