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

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

Issue 7039006: Implement GetUsageAndQuotaForEviction in QuotaManager. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Packed member variables for GetUsageAndQuotaForEviction. Created 9 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <set> 9 #include <set>
10 10
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 const FilePath& profile_path, 517 const FilePath& profile_path,
518 base::MessageLoopProxy* io_thread, 518 base::MessageLoopProxy* io_thread,
519 base::MessageLoopProxy* db_thread) 519 base::MessageLoopProxy* db_thread)
520 : is_incognito_(is_incognito), 520 : is_incognito_(is_incognito),
521 profile_path_(profile_path), 521 profile_path_(profile_path),
522 proxy_(new QuotaManagerProxy( 522 proxy_(new QuotaManagerProxy(
523 ALLOW_THIS_IN_INITIALIZER_LIST(this), io_thread)), 523 ALLOW_THIS_IN_INITIALIZER_LIST(this), io_thread)),
524 db_disabled_(false), 524 db_disabled_(false),
525 io_thread_(io_thread), 525 io_thread_(io_thread),
526 db_thread_(db_thread), 526 db_thread_(db_thread),
527 temporary_global_quota_(-1) { 527 get_usage_and_quota_for_eviction_members_(0, 0),
528 temporary_global_quota_(-1),
529 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
528 } 530 }
529 531
530 QuotaManager::~QuotaManager() { 532 QuotaManager::~QuotaManager() {
531 DCHECK(io_thread_->BelongsToCurrentThread()); 533 DCHECK(io_thread_->BelongsToCurrentThread());
532 proxy_->manager_ = NULL; 534 proxy_->manager_ = NULL;
533 std::for_each(clients_.begin(), clients_.end(), 535 std::for_each(clients_.begin(), clients_.end(),
534 std::mem_fun(&QuotaClient::OnQuotaManagerDestroyed)); 536 std::mem_fun(&QuotaClient::OnQuotaManagerDestroyed));
535 if (database_.get()) 537 if (database_.get())
536 db_thread_->DeleteSoon(FROM_HERE, database_.release()); 538 db_thread_->DeleteSoon(FROM_HERE, database_.release());
537 } 539 }
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 task->Start(); 775 task->Start();
774 } 776 }
775 777
776 void QuotaManager::EvictOriginData( 778 void QuotaManager::EvictOriginData(
777 const GURL& origin, 779 const GURL& origin,
778 StorageType type, 780 StorageType type,
779 EvictOriginDataCallback* callback) { 781 EvictOriginDataCallback* callback) {
780 // TODO(dmikurube): Implement it. 782 // TODO(dmikurube): Implement it.
781 } 783 }
782 784
785 void QuotaManager::OnGetAvailableSpaceForEviction(
786 QuotaStatusCode status,
787 int64 available_space) {
788 get_usage_and_quota_for_eviction_members_.callback_->Run(
789 status,
790 get_usage_and_quota_for_eviction_members_.usage_,
791 get_usage_and_quota_for_eviction_members_.quota_,
kinuko 2011/05/18 09:08:01 this variable name sounds way too long...? (please
Dai Mikurube (NOT FULLTIME) 2011/05/18 09:31:30 Done.
792 available_space);
793 get_usage_and_quota_for_eviction_members_.callback_.reset();
794 }
795
796 void QuotaManager::OnGetGlobalQuotaForEviction(
797 QuotaStatusCode status,
798 int64 quota) {
799 if (status != kQuotaStatusOk) {
800 get_usage_and_quota_for_eviction_members_.callback_->Run(status,
801 get_usage_and_quota_for_eviction_members_.usage_, quota, 0);
802 get_usage_and_quota_for_eviction_members_.callback_.reset();
803 return;
804 }
805
806 get_usage_and_quota_for_eviction_members_.quota_ = quota;
807 GetAvailableSpace(callback_factory_.
808 NewCallback(&QuotaManager::OnGetAvailableSpaceForEviction));
809 }
810
811 void QuotaManager::OnGetGlobalUsageForEviction(int64 usage) {
812 get_usage_and_quota_for_eviction_members_.usage_ = usage;
813 GetTemporaryGlobalQuota(callback_factory_.
814 NewCallback(&QuotaManager::OnGetGlobalQuotaForEviction));
815 }
816
783 void QuotaManager::GetUsageAndQuotaForEviction( 817 void QuotaManager::GetUsageAndQuotaForEviction(
784 GetUsageAndQuotaForEvictionCallback* callback) { 818 GetUsageAndQuotaForEvictionCallback* callback) {
785 // TODO(dmikurube): Implement it. 819 DCHECK(io_thread_->BelongsToCurrentThread());
820
821 get_usage_and_quota_for_eviction_members_.callback_.reset(callback);
822 // TODO(dmikurube): Make kStorageTypeTemporary an argument?
823 GetGlobalUsage(kStorageTypeTemporary, callback_factory_.
824 NewCallback(&QuotaManager::OnGetGlobalUsageForEviction));
786 } 825 }
787 826
788 void QuotaManager::DeleteOnCorrectThread() const { 827 void QuotaManager::DeleteOnCorrectThread() const {
789 if (!io_thread_->BelongsToCurrentThread()) { 828 if (!io_thread_->BelongsToCurrentThread()) {
790 io_thread_->DeleteSoon(FROM_HERE, this); 829 io_thread_->DeleteSoon(FROM_HERE, this);
791 return; 830 return;
792 } 831 }
793 delete this; 832 delete this;
794 } 833 }
795 834
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 917
879 QuotaManagerProxy::QuotaManagerProxy( 918 QuotaManagerProxy::QuotaManagerProxy(
880 QuotaManager* manager, base::MessageLoopProxy* io_thread) 919 QuotaManager* manager, base::MessageLoopProxy* io_thread)
881 : manager_(manager), io_thread_(io_thread) { 920 : manager_(manager), io_thread_(io_thread) {
882 } 921 }
883 922
884 QuotaManagerProxy::~QuotaManagerProxy() { 923 QuotaManagerProxy::~QuotaManagerProxy() {
885 } 924 }
886 925
887 } // namespace quota 926 } // namespace quota
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698