OLD | NEW |
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/indexed_db/indexed_db_context_impl.h" | 5 #include "content/browser/indexed_db/indexed_db_context_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 storage::kStorageTypeTemporary, | 552 storage::kStorageTypeTemporary, |
553 difference); | 553 difference); |
554 } | 554 } |
555 } | 555 } |
556 } | 556 } |
557 | 557 |
558 void IndexedDBContextImpl::GotUsageAndQuota(const GURL& origin_url, | 558 void IndexedDBContextImpl::GotUsageAndQuota(const GURL& origin_url, |
559 storage::QuotaStatusCode status, | 559 storage::QuotaStatusCode status, |
560 int64 usage, | 560 int64 usage, |
561 int64 quota) { | 561 int64 quota) { |
562 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 562 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
563 DCHECK(status == storage::kQuotaStatusOk || | 563 DCHECK(status == storage::kQuotaStatusOk || |
564 status == storage::kQuotaErrorAbort) | 564 status == storage::kQuotaErrorAbort) |
565 << "status was " << status; | 565 << "status was " << status; |
566 if (status == storage::kQuotaErrorAbort) { | 566 if (status == storage::kQuotaErrorAbort) { |
567 // We seem to no longer care to wait around for the answer. | 567 // We seem to no longer care to wait around for the answer. |
568 return; | 568 return; |
569 } | 569 } |
570 TaskRunner()->PostTask(FROM_HERE, | 570 TaskRunner()->PostTask(FROM_HERE, |
571 base::Bind(&IndexedDBContextImpl::GotUpdatedQuota, | 571 base::Bind(&IndexedDBContextImpl::GotUpdatedQuota, |
572 this, | 572 this, |
(...skipping 14 matching lines...) Expand all Loading... |
587 DCHECK(TaskRunner()->RunsTasksOnCurrentThread()); | 587 DCHECK(TaskRunner()->RunsTasksOnCurrentThread()); |
588 if (quota_manager_proxy()) { | 588 if (quota_manager_proxy()) { |
589 BrowserThread::PostTask( | 589 BrowserThread::PostTask( |
590 BrowserThread::IO, | 590 BrowserThread::IO, |
591 FROM_HERE, | 591 FROM_HERE, |
592 base::Bind( | 592 base::Bind( |
593 &IndexedDBContextImpl::QueryAvailableQuota, this, origin_url)); | 593 &IndexedDBContextImpl::QueryAvailableQuota, this, origin_url)); |
594 } | 594 } |
595 return; | 595 return; |
596 } | 596 } |
597 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 597 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
598 if (!quota_manager_proxy() || !quota_manager_proxy()->quota_manager()) | 598 if (!quota_manager_proxy() || !quota_manager_proxy()->quota_manager()) |
599 return; | 599 return; |
600 quota_manager_proxy()->quota_manager()->GetUsageAndQuota( | 600 quota_manager_proxy()->quota_manager()->GetUsageAndQuota( |
601 origin_url, | 601 origin_url, |
602 storage::kStorageTypeTemporary, | 602 storage::kStorageTypeTemporary, |
603 base::Bind(&IndexedDBContextImpl::GotUsageAndQuota, this, origin_url)); | 603 base::Bind(&IndexedDBContextImpl::GotUsageAndQuota, this, origin_url)); |
604 } | 604 } |
605 | 605 |
606 std::set<GURL>* IndexedDBContextImpl::GetOriginSet() { | 606 std::set<GURL>* IndexedDBContextImpl::GetOriginSet() { |
607 if (!origin_set_) { | 607 if (!origin_set_) { |
608 std::vector<GURL> origins; | 608 std::vector<GURL> origins; |
609 GetAllOriginsAndPaths(data_path_, &origins, NULL); | 609 GetAllOriginsAndPaths(data_path_, &origins, NULL); |
610 origin_set_.reset(new std::set<GURL>(origins.begin(), origins.end())); | 610 origin_set_.reset(new std::set<GURL>(origins.begin(), origins.end())); |
611 } | 611 } |
612 return origin_set_.get(); | 612 return origin_set_.get(); |
613 } | 613 } |
614 | 614 |
615 void IndexedDBContextImpl::ResetCaches() { | 615 void IndexedDBContextImpl::ResetCaches() { |
616 origin_set_.reset(); | 616 origin_set_.reset(); |
617 origin_size_map_.clear(); | 617 origin_size_map_.clear(); |
618 space_available_map_.clear(); | 618 space_available_map_.clear(); |
619 } | 619 } |
620 | 620 |
621 base::SequencedTaskRunner* IndexedDBContextImpl::TaskRunner() const { | 621 base::SequencedTaskRunner* IndexedDBContextImpl::TaskRunner() const { |
622 return task_runner_.get(); | 622 return task_runner_.get(); |
623 } | 623 } |
624 | 624 |
625 } // namespace content | 625 } // namespace content |
OLD | NEW |