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

Side by Side Diff: storage/browser/quota/quota_manager.cc

Issue 624063003: Replacing the OVERRIDE with override and FINAL with final in storage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed the error 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 unified diff | Download patch
« no previous file with comments | « storage/browser/quota/quota_manager.h ('k') | storage/browser/quota/usage_tracker.h » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "storage/browser/quota/quota_manager.h" 5 #include "storage/browser/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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 } 413 }
414 414
415 void DidGetAvailableSpace(QuotaStatusCode status, int64 space) { 415 void DidGetAvailableSpace(QuotaStatusCode status, int64 space) {
416 DCHECK_GE(space, 0); 416 DCHECK_GE(space, 0);
417 if (status_ == kQuotaStatusUnknown || status_ == kQuotaStatusOk) 417 if (status_ == kQuotaStatusUnknown || status_ == kQuotaStatusOk)
418 status_ = status; 418 status_ = status;
419 usage_and_quota_.available_disk_space = space; 419 usage_and_quota_.available_disk_space = space;
420 CheckCompleted(); 420 CheckCompleted();
421 } 421 }
422 422
423 virtual void Run() OVERRIDE { 423 virtual void Run() override {
424 // We initialize waiting_callbacks to 1 so that we won't run 424 // We initialize waiting_callbacks to 1 so that we won't run
425 // the completion callback until here even some of the callbacks 425 // the completion callback until here even some of the callbacks
426 // are dispatched synchronously. 426 // are dispatched synchronously.
427 CheckCompleted(); 427 CheckCompleted();
428 } 428 }
429 429
430 virtual void Aborted() OVERRIDE { 430 virtual void Aborted() override {
431 callback_.Run(kQuotaErrorAbort, UsageAndQuota()); 431 callback_.Run(kQuotaErrorAbort, UsageAndQuota());
432 DeleteSoon(); 432 DeleteSoon();
433 } 433 }
434 434
435 virtual void Completed() OVERRIDE { 435 virtual void Completed() override {
436 DCHECK(!has_usage_ || usage_and_quota_.usage >= 0); 436 DCHECK(!has_usage_ || usage_and_quota_.usage >= 0);
437 DCHECK(!has_global_limited_usage_ || 437 DCHECK(!has_global_limited_usage_ ||
438 usage_and_quota_.global_limited_usage >= 0); 438 usage_and_quota_.global_limited_usage >= 0);
439 DCHECK(!has_quota_ || usage_and_quota_.quota >= 0); 439 DCHECK(!has_quota_ || usage_and_quota_.quota >= 0);
440 DCHECK(!has_available_disk_space_ || 440 DCHECK(!has_available_disk_space_ ||
441 usage_and_quota_.available_disk_space >= 0); 441 usage_and_quota_.available_disk_space >= 0);
442 442
443 callback_.Run(status_, usage_and_quota_); 443 callback_.Run(status_, usage_and_quota_);
444 DeleteSoon(); 444 DeleteSoon();
445 } 445 }
(...skipping 21 matching lines...) Expand all
467 public: 467 public:
468 GetUsageInfoTask( 468 GetUsageInfoTask(
469 QuotaManager* manager, 469 QuotaManager* manager,
470 const GetUsageInfoCallback& callback) 470 const GetUsageInfoCallback& callback)
471 : QuotaTask(manager), 471 : QuotaTask(manager),
472 callback_(callback), 472 callback_(callback),
473 weak_factory_(this) { 473 weak_factory_(this) {
474 } 474 }
475 475
476 protected: 476 protected:
477 virtual void Run() OVERRIDE { 477 virtual void Run() override {
478 remaining_trackers_ = 3; 478 remaining_trackers_ = 3;
479 // This will populate cached hosts and usage info. 479 // This will populate cached hosts and usage info.
480 manager()->GetUsageTracker(kStorageTypeTemporary)->GetGlobalUsage( 480 manager()->GetUsageTracker(kStorageTypeTemporary)->GetGlobalUsage(
481 base::Bind(&GetUsageInfoTask::DidGetGlobalUsage, 481 base::Bind(&GetUsageInfoTask::DidGetGlobalUsage,
482 weak_factory_.GetWeakPtr(), 482 weak_factory_.GetWeakPtr(),
483 kStorageTypeTemporary)); 483 kStorageTypeTemporary));
484 manager()->GetUsageTracker(kStorageTypePersistent)->GetGlobalUsage( 484 manager()->GetUsageTracker(kStorageTypePersistent)->GetGlobalUsage(
485 base::Bind(&GetUsageInfoTask::DidGetGlobalUsage, 485 base::Bind(&GetUsageInfoTask::DidGetGlobalUsage,
486 weak_factory_.GetWeakPtr(), 486 weak_factory_.GetWeakPtr(),
487 kStorageTypePersistent)); 487 kStorageTypePersistent));
488 manager()->GetUsageTracker(kStorageTypeSyncable)->GetGlobalUsage( 488 manager()->GetUsageTracker(kStorageTypeSyncable)->GetGlobalUsage(
489 base::Bind(&GetUsageInfoTask::DidGetGlobalUsage, 489 base::Bind(&GetUsageInfoTask::DidGetGlobalUsage,
490 weak_factory_.GetWeakPtr(), 490 weak_factory_.GetWeakPtr(),
491 kStorageTypeSyncable)); 491 kStorageTypeSyncable));
492 } 492 }
493 493
494 virtual void Completed() OVERRIDE { 494 virtual void Completed() override {
495 callback_.Run(entries_); 495 callback_.Run(entries_);
496 DeleteSoon(); 496 DeleteSoon();
497 } 497 }
498 498
499 virtual void Aborted() OVERRIDE { 499 virtual void Aborted() override {
500 callback_.Run(UsageInfoEntries()); 500 callback_.Run(UsageInfoEntries());
501 DeleteSoon(); 501 DeleteSoon();
502 } 502 }
503 503
504 private: 504 private:
505 void AddEntries(StorageType type, UsageTracker* tracker) { 505 void AddEntries(StorageType type, UsageTracker* tracker) {
506 std::map<std::string, int64> host_usage; 506 std::map<std::string, int64> host_usage;
507 tracker->GetCachedHostsUsage(&host_usage); 507 tracker->GetCachedHostsUsage(&host_usage);
508 for (std::map<std::string, int64>::const_iterator iter = host_usage.begin(); 508 for (std::map<std::string, int64>::const_iterator iter = host_usage.begin();
509 iter != host_usage.end(); 509 iter != host_usage.end();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 origin_(origin), 542 origin_(origin),
543 type_(type), 543 type_(type),
544 quota_client_mask_(quota_client_mask), 544 quota_client_mask_(quota_client_mask),
545 error_count_(0), 545 error_count_(0),
546 remaining_clients_(-1), 546 remaining_clients_(-1),
547 skipped_clients_(0), 547 skipped_clients_(0),
548 callback_(callback), 548 callback_(callback),
549 weak_factory_(this) {} 549 weak_factory_(this) {}
550 550
551 protected: 551 protected:
552 virtual void Run() OVERRIDE { 552 virtual void Run() override {
553 error_count_ = 0; 553 error_count_ = 0;
554 remaining_clients_ = manager()->clients_.size(); 554 remaining_clients_ = manager()->clients_.size();
555 for (QuotaClientList::iterator iter = manager()->clients_.begin(); 555 for (QuotaClientList::iterator iter = manager()->clients_.begin();
556 iter != manager()->clients_.end(); ++iter) { 556 iter != manager()->clients_.end(); ++iter) {
557 if (quota_client_mask_ & (*iter)->id()) { 557 if (quota_client_mask_ & (*iter)->id()) {
558 (*iter)->DeleteOriginData( 558 (*iter)->DeleteOriginData(
559 origin_, type_, 559 origin_, type_,
560 base::Bind(&OriginDataDeleter::DidDeleteOriginData, 560 base::Bind(&OriginDataDeleter::DidDeleteOriginData,
561 weak_factory_.GetWeakPtr())); 561 weak_factory_.GetWeakPtr()));
562 } else { 562 } else {
563 ++skipped_clients_; 563 ++skipped_clients_;
564 if (--remaining_clients_ == 0) 564 if (--remaining_clients_ == 0)
565 CallCompleted(); 565 CallCompleted();
566 } 566 }
567 } 567 }
568 } 568 }
569 569
570 virtual void Completed() OVERRIDE { 570 virtual void Completed() override {
571 if (error_count_ == 0) { 571 if (error_count_ == 0) {
572 // Only remove the entire origin if we didn't skip any client types. 572 // Only remove the entire origin if we didn't skip any client types.
573 if (skipped_clients_ == 0) 573 if (skipped_clients_ == 0)
574 manager()->DeleteOriginFromDatabase(origin_, type_); 574 manager()->DeleteOriginFromDatabase(origin_, type_);
575 callback_.Run(kQuotaStatusOk); 575 callback_.Run(kQuotaStatusOk);
576 } else { 576 } else {
577 callback_.Run(kQuotaErrorInvalidModification); 577 callback_.Run(kQuotaErrorInvalidModification);
578 } 578 }
579 DeleteSoon(); 579 DeleteSoon();
580 } 580 }
581 581
582 virtual void Aborted() OVERRIDE { 582 virtual void Aborted() override {
583 callback_.Run(kQuotaErrorAbort); 583 callback_.Run(kQuotaErrorAbort);
584 DeleteSoon(); 584 DeleteSoon();
585 } 585 }
586 586
587 private: 587 private:
588 void DidDeleteOriginData(QuotaStatusCode status) { 588 void DidDeleteOriginData(QuotaStatusCode status) {
589 DCHECK_GT(remaining_clients_, 0); 589 DCHECK_GT(remaining_clients_, 0);
590 590
591 if (status != kQuotaStatusOk) 591 if (status != kQuotaStatusOk)
592 ++error_count_; 592 ++error_count_;
(...skipping 29 matching lines...) Expand all
622 host_(host), 622 host_(host),
623 type_(type), 623 type_(type),
624 quota_client_mask_(quota_client_mask), 624 quota_client_mask_(quota_client_mask),
625 error_count_(0), 625 error_count_(0),
626 remaining_clients_(-1), 626 remaining_clients_(-1),
627 remaining_deleters_(-1), 627 remaining_deleters_(-1),
628 callback_(callback), 628 callback_(callback),
629 weak_factory_(this) {} 629 weak_factory_(this) {}
630 630
631 protected: 631 protected:
632 virtual void Run() OVERRIDE { 632 virtual void Run() override {
633 error_count_ = 0; 633 error_count_ = 0;
634 remaining_clients_ = manager()->clients_.size(); 634 remaining_clients_ = manager()->clients_.size();
635 for (QuotaClientList::iterator iter = manager()->clients_.begin(); 635 for (QuotaClientList::iterator iter = manager()->clients_.begin();
636 iter != manager()->clients_.end(); ++iter) { 636 iter != manager()->clients_.end(); ++iter) {
637 (*iter)->GetOriginsForHost( 637 (*iter)->GetOriginsForHost(
638 type_, host_, 638 type_, host_,
639 base::Bind(&HostDataDeleter::DidGetOriginsForHost, 639 base::Bind(&HostDataDeleter::DidGetOriginsForHost,
640 weak_factory_.GetWeakPtr())); 640 weak_factory_.GetWeakPtr()));
641 } 641 }
642 } 642 }
643 643
644 virtual void Completed() OVERRIDE { 644 virtual void Completed() override {
645 if (error_count_ == 0) { 645 if (error_count_ == 0) {
646 callback_.Run(kQuotaStatusOk); 646 callback_.Run(kQuotaStatusOk);
647 } else { 647 } else {
648 callback_.Run(kQuotaErrorInvalidModification); 648 callback_.Run(kQuotaErrorInvalidModification);
649 } 649 }
650 DeleteSoon(); 650 DeleteSoon();
651 } 651 }
652 652
653 virtual void Aborted() OVERRIDE { 653 virtual void Aborted() override {
654 callback_.Run(kQuotaErrorAbort); 654 callback_.Run(kQuotaErrorAbort);
655 DeleteSoon(); 655 DeleteSoon();
656 } 656 }
657 657
658 private: 658 private:
659 void DidGetOriginsForHost(const std::set<GURL>& origins) { 659 void DidGetOriginsForHost(const std::set<GURL>& origins) {
660 DCHECK_GT(remaining_clients_, 0); 660 DCHECK_GT(remaining_clients_, 0);
661 661
662 origins_.insert(origins.begin(), origins.end()); 662 origins_.insert(origins.begin(), origins.end());
663 663
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after
1622 // |database_|, therefore we can be sure that database_ is alive when this 1622 // |database_|, therefore we can be sure that database_ is alive when this
1623 // task runs. 1623 // task runs.
1624 base::PostTaskAndReplyWithResult( 1624 base::PostTaskAndReplyWithResult(
1625 db_thread_.get(), 1625 db_thread_.get(),
1626 from_here, 1626 from_here,
1627 base::Bind(task, base::Unretained(database_.get())), 1627 base::Bind(task, base::Unretained(database_.get())),
1628 reply); 1628 reply);
1629 } 1629 }
1630 1630
1631 } // namespace storage 1631 } // namespace storage
OLDNEW
« no previous file with comments | « storage/browser/quota/quota_manager.h ('k') | storage/browser/quota/usage_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698