OLD | NEW |
---|---|
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 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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_, |
560 type_, | |
560 base::Bind(&OriginDataDeleter::DidDeleteOriginData, | 561 base::Bind(&OriginDataDeleter::DidDeleteOriginData, |
561 weak_factory_.GetWeakPtr())); | 562 weak_factory_.GetWeakPtr(), |
563 static_cast<int>((*iter)->id()))); | |
jsbell
2014/10/13 20:54:26
Is the logging below the only reason for passing t
dmurph
2014/10/14 00:16:31
Removed, sorry, debugging stuff still around.
| |
562 } else { | 564 } else { |
563 ++skipped_clients_; | 565 ++skipped_clients_; |
564 if (--remaining_clients_ == 0) | 566 if (--remaining_clients_ == 0) |
565 CallCompleted(); | 567 CallCompleted(); |
566 } | 568 } |
567 } | 569 } |
568 } | 570 } |
569 | 571 |
570 virtual void Completed() OVERRIDE { | 572 virtual void Completed() OVERRIDE { |
573 DLOG(ERROR) << "Error count " << error_count_; | |
jsbell
2014/10/13 20:54:26
remove?
dmurph
2014/10/14 00:16:31
Done.
| |
571 if (error_count_ == 0) { | 574 if (error_count_ == 0) { |
572 // Only remove the entire origin if we didn't skip any client types. | 575 // Only remove the entire origin if we didn't skip any client types. |
573 if (skipped_clients_ == 0) | 576 if (skipped_clients_ == 0) |
574 manager()->DeleteOriginFromDatabase(origin_, type_); | 577 manager()->DeleteOriginFromDatabase(origin_, type_); |
575 callback_.Run(kQuotaStatusOk); | 578 callback_.Run(kQuotaStatusOk); |
576 } else { | 579 } else { |
577 callback_.Run(kQuotaErrorInvalidModification); | 580 callback_.Run(kQuotaErrorInvalidModification); |
578 } | 581 } |
579 DeleteSoon(); | 582 DeleteSoon(); |
580 } | 583 } |
581 | 584 |
582 virtual void Aborted() OVERRIDE { | 585 virtual void Aborted() OVERRIDE { |
583 callback_.Run(kQuotaErrorAbort); | 586 callback_.Run(kQuotaErrorAbort); |
584 DeleteSoon(); | 587 DeleteSoon(); |
585 } | 588 } |
586 | 589 |
587 private: | 590 private: |
588 void DidDeleteOriginData(QuotaStatusCode status) { | 591 void DidDeleteOriginData(int id, QuotaStatusCode status) { |
592 DLOG(ERROR) << "Got status " << status << " from client " << id; | |
jsbell
2014/10/13 20:54:26
remove?
dmurph
2014/10/14 00:16:32
Done.
| |
589 DCHECK_GT(remaining_clients_, 0); | 593 DCHECK_GT(remaining_clients_, 0); |
590 | 594 |
591 if (status != kQuotaStatusOk) | 595 if (status != kQuotaStatusOk) |
592 ++error_count_; | 596 ++error_count_; |
593 | 597 |
594 if (--remaining_clients_ == 0) | 598 if (--remaining_clients_ == 0) |
595 CallCompleted(); | 599 CallCompleted(); |
596 } | 600 } |
597 | 601 |
598 QuotaManager* manager() const { | 602 QuotaManager* manager() const { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
635 for (QuotaClientList::iterator iter = manager()->clients_.begin(); | 639 for (QuotaClientList::iterator iter = manager()->clients_.begin(); |
636 iter != manager()->clients_.end(); ++iter) { | 640 iter != manager()->clients_.end(); ++iter) { |
637 (*iter)->GetOriginsForHost( | 641 (*iter)->GetOriginsForHost( |
638 type_, host_, | 642 type_, host_, |
639 base::Bind(&HostDataDeleter::DidGetOriginsForHost, | 643 base::Bind(&HostDataDeleter::DidGetOriginsForHost, |
640 weak_factory_.GetWeakPtr())); | 644 weak_factory_.GetWeakPtr())); |
641 } | 645 } |
642 } | 646 } |
643 | 647 |
644 virtual void Completed() OVERRIDE { | 648 virtual void Completed() OVERRIDE { |
649 DLOG(ERROR) << "Error count " << error_count_; | |
jsbell
2014/10/13 20:54:26
remove?
dmurph
2014/10/14 00:16:32
Done.
| |
645 if (error_count_ == 0) { | 650 if (error_count_ == 0) { |
646 callback_.Run(kQuotaStatusOk); | 651 callback_.Run(kQuotaStatusOk); |
647 } else { | 652 } else { |
648 callback_.Run(kQuotaErrorInvalidModification); | 653 callback_.Run(kQuotaErrorInvalidModification); |
649 } | 654 } |
650 DeleteSoon(); | 655 DeleteSoon(); |
651 } | 656 } |
652 | 657 |
653 virtual void Aborted() OVERRIDE { | 658 virtual void Aborted() OVERRIDE { |
654 callback_.Run(kQuotaErrorAbort); | 659 callback_.Run(kQuotaErrorAbort); |
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1622 // |database_|, therefore we can be sure that database_ is alive when this | 1627 // |database_|, therefore we can be sure that database_ is alive when this |
1623 // task runs. | 1628 // task runs. |
1624 base::PostTaskAndReplyWithResult( | 1629 base::PostTaskAndReplyWithResult( |
1625 db_thread_.get(), | 1630 db_thread_.get(), |
1626 from_here, | 1631 from_here, |
1627 base::Bind(task, base::Unretained(database_.get())), | 1632 base::Bind(task, base::Unretained(database_.get())), |
1628 reply); | 1633 reply); |
1629 } | 1634 } |
1630 | 1635 |
1631 } // namespace storage | 1636 } // namespace storage |
OLD | NEW |