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

Side by Side Diff: webkit/quota/quota_manager.cc

Issue 14307012: webkit: Remove use of ALLOW_THIS_IN_INITIALIZER_LIST. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « webkit/quota/mock_storage_client.cc ('k') | webkit/quota/quota_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "webkit/quota/quota_manager.h" 5 #include "webkit/quota/quota_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <deque> 8 #include <deque>
9 #include <functional> 9 #include <functional>
10 #include <set> 10 #include <set>
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 : QuotaTask(manager), 334 : QuotaTask(manager),
335 host_and_type_(host_and_type), 335 host_and_type_(host_and_type),
336 started_(false), 336 started_(false),
337 host_quota_(-1), 337 host_quota_(-1),
338 global_usage_(-1), 338 global_usage_(-1),
339 global_unlimited_usage_(-1), 339 global_unlimited_usage_(-1),
340 host_usage_(-1), 340 host_usage_(-1),
341 available_space_(-1), 341 available_space_(-1),
342 quota_status_(kQuotaStatusUnknown), 342 quota_status_(kQuotaStatusUnknown),
343 waiting_callbacks_(1), 343 waiting_callbacks_(1),
344 weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {} 344 weak_factory_(this) {}
345 345
346 virtual ~UsageAndQuotaDispatcherTask() {} 346 virtual ~UsageAndQuotaDispatcherTask() {}
347 347
348 // Subclasses must implement them. 348 // Subclasses must implement them.
349 virtual void RunBody() = 0; 349 virtual void RunBody() = 0;
350 virtual void DispatchCallbacks() = 0; 350 virtual void DispatchCallbacks() = 0;
351 351
352 virtual void Run() OVERRIDE { 352 virtual void Run() OVERRIDE {
353 DCHECK(!started_); 353 DCHECK(!started_);
354 started_ = true; 354 started_ = true;
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 class QuotaManager::GetUsageInfoTask : public QuotaTask { 471 class QuotaManager::GetUsageInfoTask : public QuotaTask {
472 private: 472 private:
473 typedef QuotaManager::GetUsageInfoTask self_type; 473 typedef QuotaManager::GetUsageInfoTask self_type;
474 474
475 public: 475 public:
476 GetUsageInfoTask( 476 GetUsageInfoTask(
477 QuotaManager* manager, 477 QuotaManager* manager,
478 const GetUsageInfoCallback& callback) 478 const GetUsageInfoCallback& callback)
479 : QuotaTask(manager), 479 : QuotaTask(manager),
480 callback_(callback), 480 callback_(callback),
481 weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { 481 weak_factory_(this) {
482 } 482 }
483 483
484 protected: 484 protected:
485 virtual void Run() OVERRIDE { 485 virtual void Run() OVERRIDE {
486 remaining_trackers_ = 3; 486 remaining_trackers_ = 3;
487 // This will populate cached hosts and usage info. 487 // This will populate cached hosts and usage info.
488 manager()->GetUsageTracker(kStorageTypeTemporary)->GetGlobalUsage( 488 manager()->GetUsageTracker(kStorageTypeTemporary)->GetGlobalUsage(
489 base::Bind(&GetUsageInfoTask::DidGetGlobalUsage, 489 base::Bind(&GetUsageInfoTask::DidGetGlobalUsage,
490 weak_factory_.GetWeakPtr())); 490 weak_factory_.GetWeakPtr()));
491 manager()->GetUsageTracker(kStorageTypePersistent)->GetGlobalUsage( 491 manager()->GetUsageTracker(kStorageTypePersistent)->GetGlobalUsage(
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 int quota_client_mask, 672 int quota_client_mask,
673 const StatusCallback& callback) 673 const StatusCallback& callback)
674 : QuotaTask(manager), 674 : QuotaTask(manager),
675 origin_(origin), 675 origin_(origin),
676 type_(type), 676 type_(type),
677 quota_client_mask_(quota_client_mask), 677 quota_client_mask_(quota_client_mask),
678 error_count_(0), 678 error_count_(0),
679 remaining_clients_(-1), 679 remaining_clients_(-1),
680 skipped_clients_(0), 680 skipped_clients_(0),
681 callback_(callback), 681 callback_(callback),
682 weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {} 682 weak_factory_(this) {}
683 683
684 protected: 684 protected:
685 virtual void Run() OVERRIDE { 685 virtual void Run() OVERRIDE {
686 error_count_ = 0; 686 error_count_ = 0;
687 remaining_clients_ = manager()->clients_.size(); 687 remaining_clients_ = manager()->clients_.size();
688 for (QuotaClientList::iterator iter = manager()->clients_.begin(); 688 for (QuotaClientList::iterator iter = manager()->clients_.begin();
689 iter != manager()->clients_.end(); ++iter) { 689 iter != manager()->clients_.end(); ++iter) {
690 if (quota_client_mask_ & (*iter)->id()) { 690 if (quota_client_mask_ & (*iter)->id()) {
691 (*iter)->DeleteOriginData( 691 (*iter)->DeleteOriginData(
692 origin_, type_, 692 origin_, type_,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 int quota_client_mask, 751 int quota_client_mask,
752 const StatusCallback& callback) 752 const StatusCallback& callback)
753 : QuotaTask(manager), 753 : QuotaTask(manager),
754 host_(host), 754 host_(host),
755 type_(type), 755 type_(type),
756 quota_client_mask_(quota_client_mask), 756 quota_client_mask_(quota_client_mask),
757 error_count_(0), 757 error_count_(0),
758 remaining_clients_(-1), 758 remaining_clients_(-1),
759 remaining_deleters_(-1), 759 remaining_deleters_(-1),
760 callback_(callback), 760 callback_(callback),
761 weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {} 761 weak_factory_(this) {}
762 762
763 protected: 763 protected:
764 virtual void Run() OVERRIDE { 764 virtual void Run() OVERRIDE {
765 error_count_ = 0; 765 error_count_ = 0;
766 remaining_clients_ = manager()->clients_.size(); 766 remaining_clients_ = manager()->clients_.size();
767 for (QuotaClientList::iterator iter = manager()->clients_.begin(); 767 for (QuotaClientList::iterator iter = manager()->clients_.begin();
768 iter != manager()->clients_.end(); ++iter) { 768 iter != manager()->clients_.end(); ++iter) {
769 (*iter)->GetOriginsForHost( 769 (*iter)->GetOriginsForHost(
770 type_, host_, 770 type_, host_,
771 base::Bind(&HostDataDeleter::DidGetOriginsForHost, 771 base::Bind(&HostDataDeleter::DidGetOriginsForHost,
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 // QuotaManager --------------------------------------------------------------- 934 // QuotaManager ---------------------------------------------------------------
935 935
936 QuotaManager::QuotaManager(bool is_incognito, 936 QuotaManager::QuotaManager(bool is_incognito,
937 const base::FilePath& profile_path, 937 const base::FilePath& profile_path,
938 base::SingleThreadTaskRunner* io_thread, 938 base::SingleThreadTaskRunner* io_thread,
939 base::SequencedTaskRunner* db_thread, 939 base::SequencedTaskRunner* db_thread,
940 SpecialStoragePolicy* special_storage_policy) 940 SpecialStoragePolicy* special_storage_policy)
941 : is_incognito_(is_incognito), 941 : is_incognito_(is_incognito),
942 profile_path_(profile_path), 942 profile_path_(profile_path),
943 proxy_(new QuotaManagerProxy( 943 proxy_(new QuotaManagerProxy(
944 ALLOW_THIS_IN_INITIALIZER_LIST(this), io_thread)), 944 this, io_thread)),
945 db_disabled_(false), 945 db_disabled_(false),
946 eviction_disabled_(false), 946 eviction_disabled_(false),
947 io_thread_(io_thread), 947 io_thread_(io_thread),
948 db_thread_(db_thread), 948 db_thread_(db_thread),
949 temporary_quota_initialized_(false), 949 temporary_quota_initialized_(false),
950 temporary_quota_override_(-1), 950 temporary_quota_override_(-1),
951 desired_available_space_(-1), 951 desired_available_space_(-1),
952 special_storage_policy_(special_storage_policy), 952 special_storage_policy_(special_storage_policy),
953 weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), 953 weak_factory_(this),
954 get_disk_space_fn_(&CallSystemGetAmountOfFreeDiskSpace) { 954 get_disk_space_fn_(&CallSystemGetAmountOfFreeDiskSpace) {
955 } 955 }
956 956
957 void QuotaManager::GetUsageInfo(const GetUsageInfoCallback& callback) { 957 void QuotaManager::GetUsageInfo(const GetUsageInfoCallback& callback) {
958 LazyInitialize(); 958 LazyInitialize();
959 GetUsageInfoTask* get_usage_info = new GetUsageInfoTask(this, callback); 959 GetUsageInfoTask* get_usage_info = new GetUsageInfoTask(this, callback);
960 get_usage_info->Start(); 960 get_usage_info->Start();
961 } 961 }
962 962
963 void QuotaManager::GetUsageAndQuotaForWebApps( 963 void QuotaManager::GetUsageAndQuotaForWebApps(
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after
1804 1804
1805 QuotaManagerProxy::QuotaManagerProxy( 1805 QuotaManagerProxy::QuotaManagerProxy(
1806 QuotaManager* manager, base::SingleThreadTaskRunner* io_thread) 1806 QuotaManager* manager, base::SingleThreadTaskRunner* io_thread)
1807 : manager_(manager), io_thread_(io_thread) { 1807 : manager_(manager), io_thread_(io_thread) {
1808 } 1808 }
1809 1809
1810 QuotaManagerProxy::~QuotaManagerProxy() { 1810 QuotaManagerProxy::~QuotaManagerProxy() {
1811 } 1811 }
1812 1812
1813 } // namespace quota 1813 } // namespace quota
OLDNEW
« no previous file with comments | « webkit/quota/mock_storage_client.cc ('k') | webkit/quota/quota_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698