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

Side by Side Diff: chrome/browser/ui/webui/quota_internals/quota_internals_proxy.cc

Issue 1394563002: Add trace to the caller of QuotaManager::GetAvailableSpace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
OLDNEW
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 }
34 quota_manager_ = quota_manager;
35 {
36 // crbug.com/349708
37 TRACE_EVENT0("io", "QuotaInternalsProxy::RequestInfo");
33 38
34 quota_manager_ = quota_manager; 39 quota_manager_->GetAvailableSpace(
35 quota_manager_->GetAvailableSpace( 40 base::Bind(&QuotaInternalsProxy::DidGetAvailableSpace,
36 base::Bind(&QuotaInternalsProxy::DidGetAvailableSpace, 41 weak_factory_.GetWeakPtr()));
37 weak_factory_.GetWeakPtr())); 42 }
38 43
39 quota_manager_->GetTemporaryGlobalQuota( 44 quota_manager_->GetTemporaryGlobalQuota(
40 base::Bind(&QuotaInternalsProxy::DidGetGlobalQuota, 45 base::Bind(&QuotaInternalsProxy::DidGetGlobalQuota,
41 weak_factory_.GetWeakPtr(), 46 weak_factory_.GetWeakPtr(),
42 storage::kStorageTypeTemporary)); 47 storage::kStorageTypeTemporary));
43 48
44 quota_manager_->GetGlobalUsage( 49 quota_manager_->GetGlobalUsage(
45 storage::kStorageTypeTemporary, 50 storage::kStorageTypeTemporary,
46 base::Bind(&QuotaInternalsProxy::DidGetGlobalUsage, 51 base::Bind(&QuotaInternalsProxy::DidGetGlobalUsage,
47 weak_factory_.GetWeakPtr(), 52 weak_factory_.GetWeakPtr(),
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 RELAY_TO_HANDLER(ReportAvailableSpace, int64) 96 RELAY_TO_HANDLER(ReportAvailableSpace, int64)
92 RELAY_TO_HANDLER(ReportGlobalInfo, const GlobalStorageInfo&) 97 RELAY_TO_HANDLER(ReportGlobalInfo, const GlobalStorageInfo&)
93 RELAY_TO_HANDLER(ReportPerHostInfo, const std::vector<PerHostStorageInfo>&) 98 RELAY_TO_HANDLER(ReportPerHostInfo, const std::vector<PerHostStorageInfo>&)
94 RELAY_TO_HANDLER(ReportPerOriginInfo, const std::vector<PerOriginStorageInfo>&) 99 RELAY_TO_HANDLER(ReportPerOriginInfo, const std::vector<PerOriginStorageInfo>&)
95 RELAY_TO_HANDLER(ReportStatistics, const Statistics&) 100 RELAY_TO_HANDLER(ReportStatistics, const Statistics&)
96 101
97 #undef RELAY_TO_HANDLER 102 #undef RELAY_TO_HANDLER
98 103
99 void QuotaInternalsProxy::DidGetAvailableSpace(storage::QuotaStatusCode status, 104 void QuotaInternalsProxy::DidGetAvailableSpace(storage::QuotaStatusCode status,
100 int64 space) { 105 int64 space) {
106 // crbug.com/349708
107 TRACE_EVENT0("io", "QuotaInternalsProxy::DidGetAvailableSpace");
108
101 if (status == storage::kQuotaStatusOk) 109 if (status == storage::kQuotaStatusOk)
102 ReportAvailableSpace(space); 110 ReportAvailableSpace(space);
103 } 111 }
104 112
105 void QuotaInternalsProxy::DidGetGlobalQuota(storage::StorageType type, 113 void QuotaInternalsProxy::DidGetGlobalQuota(storage::StorageType type,
106 storage::QuotaStatusCode status, 114 storage::QuotaStatusCode status,
107 int64 quota) { 115 int64 quota) {
108 if (status == storage::kQuotaStatusOk) { 116 if (status == storage::kQuotaStatusOk) {
109 GlobalStorageInfo info(type); 117 GlobalStorageInfo info(type);
110 info.set_quota(quota); 118 info.set_quota(quota);
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 DCHECK(quota_manager_.get()); 229 DCHECK(quota_manager_.get());
222 quota_manager_->GetHostUsage(host, 230 quota_manager_->GetHostUsage(host,
223 type, 231 type,
224 base::Bind(&QuotaInternalsProxy::DidGetHostUsage, 232 base::Bind(&QuotaInternalsProxy::DidGetHostUsage,
225 weak_factory_.GetWeakPtr(), 233 weak_factory_.GetWeakPtr(),
226 host, 234 host,
227 type)); 235 type));
228 } 236 }
229 237
230 } // namespace quota_internals 238 } // namespace quota_internals
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698