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

Side by Side Diff: content/browser/storage_partition_impl.cc

Issue 2658473002: Refactor BluetoothAllowedDevicesMap (Closed)
Patch Set: clean up code Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/storage_partition_impl.h" 5 #include "content/browser/storage_partition_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 DOMStorageContextWrapper* dom_storage_context, 370 DOMStorageContextWrapper* dom_storage_context,
371 IndexedDBContextImpl* indexed_db_context, 371 IndexedDBContextImpl* indexed_db_context,
372 CacheStorageContextImpl* cache_storage_context, 372 CacheStorageContextImpl* cache_storage_context,
373 ServiceWorkerContextWrapper* service_worker_context, 373 ServiceWorkerContextWrapper* service_worker_context,
374 PushMessagingContext* push_messaging_context, 374 PushMessagingContext* push_messaging_context,
375 storage::SpecialStoragePolicy* special_storage_policy, 375 storage::SpecialStoragePolicy* special_storage_policy,
376 HostZoomLevelContext* host_zoom_level_context, 376 HostZoomLevelContext* host_zoom_level_context,
377 PlatformNotificationContextImpl* platform_notification_context, 377 PlatformNotificationContextImpl* platform_notification_context,
378 BackgroundSyncContext* background_sync_context, 378 BackgroundSyncContext* background_sync_context,
379 PaymentAppContextImpl* payment_app_context, 379 PaymentAppContextImpl* payment_app_context,
380 scoped_refptr<BroadcastChannelProvider> broadcast_channel_provider) 380 scoped_refptr<BroadcastChannelProvider> broadcast_channel_provider,
381 scoped_refptr<BluetoothAllowedDevicesMap> bluetooth_allowed_devices_map)
381 : partition_path_(partition_path), 382 : partition_path_(partition_path),
382 quota_manager_(quota_manager), 383 quota_manager_(quota_manager),
383 appcache_service_(appcache_service), 384 appcache_service_(appcache_service),
384 filesystem_context_(filesystem_context), 385 filesystem_context_(filesystem_context),
385 database_tracker_(database_tracker), 386 database_tracker_(database_tracker),
386 dom_storage_context_(dom_storage_context), 387 dom_storage_context_(dom_storage_context),
387 indexed_db_context_(indexed_db_context), 388 indexed_db_context_(indexed_db_context),
388 cache_storage_context_(cache_storage_context), 389 cache_storage_context_(cache_storage_context),
389 service_worker_context_(service_worker_context), 390 service_worker_context_(service_worker_context),
390 push_messaging_context_(push_messaging_context), 391 push_messaging_context_(push_messaging_context),
391 special_storage_policy_(special_storage_policy), 392 special_storage_policy_(special_storage_policy),
392 host_zoom_level_context_(host_zoom_level_context), 393 host_zoom_level_context_(host_zoom_level_context),
393 platform_notification_context_(platform_notification_context), 394 platform_notification_context_(platform_notification_context),
394 background_sync_context_(background_sync_context), 395 background_sync_context_(background_sync_context),
395 payment_app_context_(payment_app_context), 396 payment_app_context_(payment_app_context),
396 broadcast_channel_provider_(std::move(broadcast_channel_provider)), 397 broadcast_channel_provider_(std::move(broadcast_channel_provider)),
398 bluetooth_allowed_devices_map_(std::move(bluetooth_allowed_devices_map)),
397 browser_context_(browser_context) {} 399 browser_context_(browser_context) {}
398 400
399 StoragePartitionImpl::~StoragePartitionImpl() { 401 StoragePartitionImpl::~StoragePartitionImpl() {
400 browser_context_ = nullptr; 402 browser_context_ = nullptr;
401 403
402 // These message loop checks are just to avoid leaks in unittests. 404 // These message loop checks are just to avoid leaks in unittests.
403 if (GetDatabaseTracker() && 405 if (GetDatabaseTracker() &&
404 BrowserThread::IsMessageLoopValid(BrowserThread::FILE)) { 406 BrowserThread::IsMessageLoopValid(BrowserThread::FILE)) {
405 BrowserThread::PostTask( 407 BrowserThread::PostTask(
406 BrowserThread::FILE, 408 BrowserThread::FILE,
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 new BackgroundSyncContext(); 523 new BackgroundSyncContext();
522 background_sync_context->Init(service_worker_context); 524 background_sync_context->Init(service_worker_context);
523 525
524 scoped_refptr<PaymentAppContextImpl> payment_app_context = 526 scoped_refptr<PaymentAppContextImpl> payment_app_context =
525 new PaymentAppContextImpl(); 527 new PaymentAppContextImpl();
526 payment_app_context->Init(service_worker_context); 528 payment_app_context->Init(service_worker_context);
527 529
528 scoped_refptr<BroadcastChannelProvider> 530 scoped_refptr<BroadcastChannelProvider>
529 broadcast_channel_provider = new BroadcastChannelProvider(); 531 broadcast_channel_provider = new BroadcastChannelProvider();
530 532
533 scoped_refptr<BluetoothAllowedDevicesMap> bluetooth_allowed_devices_map =
534 new BluetoothAllowedDevicesMap();
535
531 std::unique_ptr<StoragePartitionImpl> storage_partition( 536 std::unique_ptr<StoragePartitionImpl> storage_partition(
532 new StoragePartitionImpl( 537 new StoragePartitionImpl(
533 context, partition_path, quota_manager.get(), appcache_service.get(), 538 context, partition_path, quota_manager.get(), appcache_service.get(),
534 filesystem_context.get(), database_tracker.get(), 539 filesystem_context.get(), database_tracker.get(),
535 dom_storage_context.get(), indexed_db_context.get(), 540 dom_storage_context.get(), indexed_db_context.get(),
536 cache_storage_context.get(), service_worker_context.get(), 541 cache_storage_context.get(), service_worker_context.get(),
537 push_messaging_context.get(), special_storage_policy.get(), 542 push_messaging_context.get(), special_storage_policy.get(),
538 host_zoom_level_context.get(), platform_notification_context.get(), 543 host_zoom_level_context.get(), platform_notification_context.get(),
539 background_sync_context.get(), payment_app_context.get(), 544 background_sync_context.get(), payment_app_context.get(),
540 std::move(broadcast_channel_provider))); 545 std::move(broadcast_channel_provider),
546 std::move(bluetooth_allowed_devices_map)));
541 547
542 service_worker_context->set_storage_partition(storage_partition.get()); 548 service_worker_context->set_storage_partition(storage_partition.get());
543 549
544 return storage_partition; 550 return storage_partition;
545 } 551 }
546 552
547 base::FilePath StoragePartitionImpl::GetPath() { 553 base::FilePath StoragePartitionImpl::GetPath() {
548 return partition_path_; 554 return partition_path_;
549 } 555 }
550 556
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 } 619 }
614 620
615 PaymentAppContextImpl* StoragePartitionImpl::GetPaymentAppContext() { 621 PaymentAppContextImpl* StoragePartitionImpl::GetPaymentAppContext() {
616 return payment_app_context_.get(); 622 return payment_app_context_.get();
617 } 623 }
618 624
619 BroadcastChannelProvider* StoragePartitionImpl::GetBroadcastChannelProvider() { 625 BroadcastChannelProvider* StoragePartitionImpl::GetBroadcastChannelProvider() {
620 return broadcast_channel_provider_.get(); 626 return broadcast_channel_provider_.get();
621 } 627 }
622 628
629 BluetoothAllowedDevicesMap*
630 StoragePartitionImpl::GetBluetoothAllowedDevicesMap() {
631 return bluetooth_allowed_devices_map_.get();
632 }
633
623 void StoragePartitionImpl::OpenLocalStorage( 634 void StoragePartitionImpl::OpenLocalStorage(
624 const url::Origin& origin, 635 const url::Origin& origin,
625 mojo::InterfaceRequest<mojom::LevelDBWrapper> request) { 636 mojo::InterfaceRequest<mojom::LevelDBWrapper> request) {
626 dom_storage_context_->OpenLocalStorage(origin, std::move(request)); 637 dom_storage_context_->OpenLocalStorage(origin, std::move(request));
627 } 638 }
628 639
629 void StoragePartitionImpl::ClearDataImpl( 640 void StoragePartitionImpl::ClearDataImpl(
630 uint32_t remove_mask, 641 uint32_t remove_mask,
631 uint32_t quota_storage_remove_mask, 642 uint32_t quota_storage_remove_mask,
632 const GURL& storage_origin, 643 const GURL& storage_origin,
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 ClearDataImpl(remove_mask, quota_storage_remove_mask, GURL(), origin_matcher, 914 ClearDataImpl(remove_mask, quota_storage_remove_mask, GURL(), origin_matcher,
904 cookie_matcher, GetURLRequestContext(), begin, end, callback); 915 cookie_matcher, GetURLRequestContext(), begin, end, callback);
905 } 916 }
906 917
907 void StoragePartitionImpl::Flush() { 918 void StoragePartitionImpl::Flush() {
908 DCHECK_CURRENTLY_ON(BrowserThread::UI); 919 DCHECK_CURRENTLY_ON(BrowserThread::UI);
909 if (GetDOMStorageContext()) 920 if (GetDOMStorageContext())
910 GetDOMStorageContext()->Flush(); 921 GetDOMStorageContext()->Flush();
911 } 922 }
912 923
924 void StoragePartitionImpl::ClearBluetoothAllowedDevicesMap() {
925 bluetooth_allowed_devices_map_->Clear();
926 }
927
913 BrowserContext* StoragePartitionImpl::browser_context() const { 928 BrowserContext* StoragePartitionImpl::browser_context() const {
914 return browser_context_; 929 return browser_context_;
915 } 930 }
916 931
917 void StoragePartitionImpl::Bind( 932 void StoragePartitionImpl::Bind(
918 mojo::InterfaceRequest<mojom::StoragePartitionService> request) { 933 mojo::InterfaceRequest<mojom::StoragePartitionService> request) {
919 bindings_.AddBinding(this, std::move(request)); 934 bindings_.AddBinding(this, std::move(request));
920 } 935 }
921 936
922 void StoragePartitionImpl::OverrideQuotaManagerForTesting( 937 void StoragePartitionImpl::OverrideQuotaManagerForTesting(
(...skipping 10 matching lines...) Expand all
933 net::URLRequestContextGetter* url_request_context) { 948 net::URLRequestContextGetter* url_request_context) {
934 url_request_context_ = url_request_context; 949 url_request_context_ = url_request_context;
935 } 950 }
936 951
937 void StoragePartitionImpl::SetMediaURLRequestContext( 952 void StoragePartitionImpl::SetMediaURLRequestContext(
938 net::URLRequestContextGetter* media_url_request_context) { 953 net::URLRequestContextGetter* media_url_request_context) {
939 media_url_request_context_ = media_url_request_context; 954 media_url_request_context_ = media_url_request_context;
940 } 955 }
941 956
942 } // namespace content 957 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698