| 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 "chrome/browser/ui/webui/quota_internals/quota_internals_proxy.h" | 5 #include "chrome/browser/ui/webui/quota_internals/quota_internals_proxy.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/trace_event/trace_event.h" |
| 11 #include "chrome/browser/ui/webui/quota_internals/quota_internals_handler.h" | 12 #include "chrome/browser/ui/webui/quota_internals/quota_internals_handler.h" |
| 12 #include "chrome/browser/ui/webui/quota_internals/quota_internals_types.h" | 13 #include "chrome/browser/ui/webui/quota_internals/quota_internals_types.h" |
| 13 #include "net/base/net_util.h" | 14 #include "net/base/net_util.h" |
| 14 | 15 |
| 15 using content::BrowserThread; | 16 using content::BrowserThread; |
| 16 | 17 |
| 17 namespace quota_internals { | 18 namespace quota_internals { |
| 18 | 19 |
| 19 QuotaInternalsProxy::QuotaInternalsProxy(QuotaInternalsHandler* handler) | 20 QuotaInternalsProxy::QuotaInternalsProxy(QuotaInternalsHandler* handler) |
| 20 : handler_(handler), | 21 : handler_(handler), |
| 21 weak_factory_(this) { | 22 weak_factory_(this) { |
| 22 } | 23 } |
| 23 | 24 |
| 24 void QuotaInternalsProxy::RequestInfo( | 25 void QuotaInternalsProxy::RequestInfo( |
| 25 scoped_refptr<storage::QuotaManager> quota_manager) { | 26 scoped_refptr<storage::QuotaManager> quota_manager) { |
| 26 DCHECK(quota_manager.get()); | 27 DCHECK(quota_manager.get()); |
| 27 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { | 28 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { |
| 28 BrowserThread::PostTask( | 29 BrowserThread::PostTask( |
| 29 BrowserThread::IO, FROM_HERE, | 30 BrowserThread::IO, FROM_HERE, |
| 30 base::Bind(&QuotaInternalsProxy::RequestInfo, this, quota_manager)); | 31 base::Bind(&QuotaInternalsProxy::RequestInfo, this, quota_manager)); |
| 31 return; | 32 return; |
| 32 } | 33 } |
| 33 | |
| 34 quota_manager_ = quota_manager; | 34 quota_manager_ = quota_manager; |
| 35 quota_manager_->GetAvailableSpace( | 35 { |
| 36 base::Bind(&QuotaInternalsProxy::DidGetAvailableSpace, | 36 // crbug.com/349708 |
| 37 weak_factory_.GetWeakPtr())); | 37 TRACE_EVENT0("io", "QuotaInternalsProxy::RequestInfo"); |
| 38 quota_manager_->GetAvailableSpace( |
| 39 base::Bind(&QuotaInternalsProxy::DidGetAvailableSpace, |
| 40 weak_factory_.GetWeakPtr())); |
| 41 } |
| 38 | 42 |
| 39 quota_manager_->GetTemporaryGlobalQuota( | 43 quota_manager_->GetTemporaryGlobalQuota( |
| 40 base::Bind(&QuotaInternalsProxy::DidGetGlobalQuota, | 44 base::Bind(&QuotaInternalsProxy::DidGetGlobalQuota, |
| 41 weak_factory_.GetWeakPtr(), | 45 weak_factory_.GetWeakPtr(), |
| 42 storage::kStorageTypeTemporary)); | 46 storage::kStorageTypeTemporary)); |
| 43 | 47 |
| 44 quota_manager_->GetGlobalUsage( | 48 quota_manager_->GetGlobalUsage( |
| 45 storage::kStorageTypeTemporary, | 49 storage::kStorageTypeTemporary, |
| 46 base::Bind(&QuotaInternalsProxy::DidGetGlobalUsage, | 50 base::Bind(&QuotaInternalsProxy::DidGetGlobalUsage, |
| 47 weak_factory_.GetWeakPtr(), | 51 weak_factory_.GetWeakPtr(), |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 DCHECK(quota_manager_.get()); | 225 DCHECK(quota_manager_.get()); |
| 222 quota_manager_->GetHostUsage(host, | 226 quota_manager_->GetHostUsage(host, |
| 223 type, | 227 type, |
| 224 base::Bind(&QuotaInternalsProxy::DidGetHostUsage, | 228 base::Bind(&QuotaInternalsProxy::DidGetHostUsage, |
| 225 weak_factory_.GetWeakPtr(), | 229 weak_factory_.GetWeakPtr(), |
| 226 host, | 230 host, |
| 227 type)); | 231 type)); |
| 228 } | 232 } |
| 229 | 233 |
| 230 } // namespace quota_internals | 234 } // namespace quota_internals |
| OLD | NEW |