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

Unified Diff: content/browser/storage_partition_impl.cc

Issue 645763003: Refactor GeofencingManager to have one instance per StoragePartition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: have reference to service worker context in geofencing manager Created 6 years, 2 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
Index: content/browser/storage_partition_impl.cc
diff --git a/content/browser/storage_partition_impl.cc b/content/browser/storage_partition_impl.cc
index 42a5195fb805f58499d442683916ceab46688ab7..ff8539862d16a2f50e20a51ca0e214c968b98100 100644
--- a/content/browser/storage_partition_impl.cc
+++ b/content/browser/storage_partition_impl.cc
@@ -8,6 +8,7 @@
#include "base/strings/utf_string_conversions.h"
#include "content/browser/browser_main_loop.h"
#include "content/browser/fileapi/browser_file_system_helper.h"
+#include "content/browser/geofencing/geofencing_manager.h"
#include "content/browser/gpu/shader_disk_cache.h"
#include "content/common/dom_storage/dom_storage_types.h"
#include "content/public/browser/browser_context.h"
@@ -362,7 +363,8 @@ StoragePartitionImpl::StoragePartitionImpl(
IndexedDBContextImpl* indexed_db_context,
ServiceWorkerContextWrapper* service_worker_context,
WebRTCIdentityStore* webrtc_identity_store,
- storage::SpecialStoragePolicy* special_storage_policy)
+ storage::SpecialStoragePolicy* special_storage_policy,
+ GeofencingManager* geofencing_manager)
: partition_path_(partition_path),
quota_manager_(quota_manager),
appcache_service_(appcache_service),
@@ -372,7 +374,8 @@ StoragePartitionImpl::StoragePartitionImpl(
indexed_db_context_(indexed_db_context),
service_worker_context_(service_worker_context),
webrtc_identity_store_(webrtc_identity_store),
- special_storage_policy_(special_storage_policy) {
+ special_storage_policy_(special_storage_policy),
+ geofencing_manager_(geofencing_manager) {
}
StoragePartitionImpl::~StoragePartitionImpl() {
@@ -393,6 +396,9 @@ StoragePartitionImpl::~StoragePartitionImpl() {
if (GetServiceWorkerContext())
GetServiceWorkerContext()->Shutdown();
+
+ if (GetGeofencingManager())
+ GetGeofencingManager()->Shutdown();
}
// TODO(ajwong): Break the direct dependency on |context|. We only
@@ -463,6 +469,10 @@ StoragePartitionImpl* StoragePartitionImpl::Create(
scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy(
context->GetSpecialStoragePolicy());
+ scoped_refptr<GeofencingManager> geofencing_manager =
+ new GeofencingManager(service_worker_context);
+ geofencing_manager->Init();
+
return new StoragePartitionImpl(partition_path,
quota_manager.get(),
appcache_service.get(),
@@ -472,7 +482,8 @@ StoragePartitionImpl* StoragePartitionImpl::Create(
indexed_db_context.get(),
service_worker_context.get(),
webrtc_identity_store.get(),
- special_storage_policy.get());
+ special_storage_policy.get(),
+ geofencing_manager.get());
}
base::FilePath StoragePartitionImpl::GetPath() {
@@ -516,6 +527,10 @@ ServiceWorkerContextWrapper* StoragePartitionImpl::GetServiceWorkerContext() {
return service_worker_context_.get();
}
+GeofencingManager* StoragePartitionImpl::GetGeofencingManager() {
+ return geofencing_manager_.get();
+}
+
void StoragePartitionImpl::ClearDataImpl(
uint32 remove_mask,
uint32 quota_storage_remove_mask,

Powered by Google App Engine
This is Rietveld 408576698