Index: content/browser/devtools/protocol/usage_and_quota_query.cc |
diff --git a/content/browser/devtools/protocol/usage_and_quota_query.cc b/content/browser/devtools/protocol/usage_and_quota_query.cc |
index 2936fe1e079a244ed6983746ced2e28eaebdbffe..f9f8e77485efcd8d518eb7044388268cdcccdba6 100644 |
--- a/content/browser/devtools/protocol/usage_and_quota_query.cc |
+++ b/content/browser/devtools/protocol/usage_and_quota_query.cc |
@@ -14,7 +14,7 @@ namespace { |
class UsageQuery : public base::RefCounted<UsageQuery> { |
public: |
- using Callback = base::Callback<void(const std::vector<UsageItem>&)>; |
+ using Callback = base::Callback<void(scoped_ptr<ListBuilder<UsageItem>>)>; |
UsageQuery(scoped_refptr<storage::QuotaManager> quota_manager, |
const std::string& host, |
@@ -40,7 +40,7 @@ class UsageQuery : public base::RefCounted<UsageQuery> { |
friend class base::RefCounted<UsageQuery>; |
~UsageQuery() { |
- callback_.Run(usage_list_); |
+ callback_.Run(usage_list_.Pass()); |
} |
void GetForClient(storage::QuotaClient::ID client_id, |
@@ -53,16 +53,16 @@ class UsageQuery : public base::RefCounted<UsageQuery> { |
} |
void DidGetForClient(const std::string& client_name, int64 value) { |
- UsageItem usage_item; |
- usage_item.set_id(client_name); |
- usage_item.set_value(value); |
- usage_list_.push_back(usage_item); |
+ scoped_ptr<UsageItem> usage_item(new UsageItem); |
+ usage_item->set_id(client_name); |
+ usage_item->set_value(value); |
+ usage_list_->push_back(usage_item.Pass()); |
} |
scoped_refptr<storage::QuotaManager> quota_manager_; |
std::string host_; |
storage::StorageType storage_type_; |
- std::vector<UsageItem> usage_list_; |
+ scoped_ptr<ListBuilder<UsageItem>> usage_list_; |
Callback callback_; |
}; |
@@ -84,19 +84,22 @@ UsageAndQuotaQuery::UsageAndQuotaQuery( |
net::GetHostOrSpecFromURL(security_origin), |
base::Bind(&UsageAndQuotaQuery::DidGetPersistentQuota, this)); |
GetHostUsage(storage::kStorageTypeTemporary, |
- base::Bind(&Usage::set_temporary, base::Unretained(&usage_))); |
+ base::Bind(&Usage::set_temporary, |
+ base::Unretained(usage_.get()))); |
GetHostUsage(storage::kStorageTypePersistent, |
- base::Bind(&Usage::set_persistent, base::Unretained(&usage_))); |
+ base::Bind(&Usage::set_persistent, |
+ base::Unretained(usage_.get()))); |
GetHostUsage(storage::kStorageTypeSyncable, |
- base::Bind(&Usage::set_syncable, base::Unretained(&usage_))); |
+ base::Bind(&Usage::set_syncable, |
+ base::Unretained(usage_.get()))); |
Release(); |
} |
UsageAndQuotaQuery::~UsageAndQuotaQuery() { |
scoped_ptr<QueryUsageAndQuotaResponse> response( |
new QueryUsageAndQuotaResponse); |
- response->set_quota(quota_); |
- response->set_usage(usage_); |
+ response->set_quota(quota_.Pass()); |
+ response->set_usage(usage_.Pass()); |
callback_.Run(response.Pass()); |
} |
@@ -104,13 +107,13 @@ void UsageAndQuotaQuery::DidGetTemporaryQuota(storage::QuotaStatusCode status, |
int64 used_bytes, |
int64 quota_in_bytes) { |
if (status == storage::kQuotaStatusOk) |
- quota_.set_temporary(quota_in_bytes); |
+ quota_->set_temporary(quota_in_bytes); |
} |
void UsageAndQuotaQuery::DidGetPersistentQuota(storage::QuotaStatusCode status, |
int64 value) { |
if (status == storage::kQuotaStatusOk) |
- quota_.set_persistent(value); |
+ quota_->set_persistent(value); |
} |
void UsageAndQuotaQuery::GetHostUsage( |
@@ -127,8 +130,8 @@ void UsageAndQuotaQuery::GetHostUsage( |
void UsageAndQuotaQuery::DidGetHostUsage( |
const UsageItemsCallback& items_callback, |
- const std::vector<UsageItem>& usage_list) { |
- items_callback.Run(usage_list); |
+ scoped_ptr<ListBuilder<UsageItem>> usage_list) { |
+ items_callback.Run(usage_list.Pass()); |
} |
} // namespace page |