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

Side by Side Diff: content/browser/indexed_db/indexed_db_context_impl.cc

Issue 108603005: Update uses of Value in chromeos/, cloud_print/, components/, content/ to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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) 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 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 idb_directory, 155 idb_directory,
156 connection_count)); 156 connection_count));
157 } 157 }
158 return result; 158 return result;
159 } 159 }
160 160
161 static bool HostNameComparator(const GURL& i, const GURL& j) { 161 static bool HostNameComparator(const GURL& i, const GURL& j) {
162 return i.host() < j.host(); 162 return i.host() < j.host();
163 } 163 }
164 164
165 ListValue* IndexedDBContextImpl::GetAllOriginsDetails() { 165 base::ListValue* IndexedDBContextImpl::GetAllOriginsDetails() {
166 DCHECK(TaskRunner()->RunsTasksOnCurrentThread()); 166 DCHECK(TaskRunner()->RunsTasksOnCurrentThread());
167 std::vector<GURL> origins = GetAllOrigins(); 167 std::vector<GURL> origins = GetAllOrigins();
168 168
169 std::sort(origins.begin(), origins.end(), HostNameComparator); 169 std::sort(origins.begin(), origins.end(), HostNameComparator);
170 170
171 scoped_ptr<ListValue> list(new ListValue()); 171 scoped_ptr<base::ListValue> list(new base::ListValue());
172 for (std::vector<GURL>::const_iterator iter = origins.begin(); 172 for (std::vector<GURL>::const_iterator iter = origins.begin();
173 iter != origins.end(); 173 iter != origins.end();
174 ++iter) { 174 ++iter) {
175 const GURL& origin_url = *iter; 175 const GURL& origin_url = *iter;
176 176
177 scoped_ptr<DictionaryValue> info(new DictionaryValue()); 177 scoped_ptr<base::DictionaryValue> info(new base::DictionaryValue());
178 info->SetString("url", origin_url.spec()); 178 info->SetString("url", origin_url.spec());
179 info->SetString("size", ui::FormatBytes(GetOriginDiskUsage(origin_url))); 179 info->SetString("size", ui::FormatBytes(GetOriginDiskUsage(origin_url)));
180 info->SetDouble("last_modified", 180 info->SetDouble("last_modified",
181 GetOriginLastModified(origin_url).ToJsTime()); 181 GetOriginLastModified(origin_url).ToJsTime());
182 info->SetString("path", GetFilePath(origin_url).value()); 182 info->SetString("path", GetFilePath(origin_url).value());
183 info->SetDouble("connection_count", GetConnectionCount(origin_url)); 183 info->SetDouble("connection_count", GetConnectionCount(origin_url));
184 184
185 // This ends up being O(n^2) since we iterate over all open databases 185 // This ends up being O(n^2) since we iterate over all open databases
186 // to extract just those in the origin, and we're iterating over all 186 // to extract just those in the origin, and we're iterating over all
187 // origins in the outer loop. 187 // origins in the outer loop.
188 188
189 if (factory_) { 189 if (factory_) {
190 std::vector<IndexedDBDatabase*> databases = 190 std::vector<IndexedDBDatabase*> databases =
191 factory_->GetOpenDatabasesForOrigin(origin_url); 191 factory_->GetOpenDatabasesForOrigin(origin_url);
192 // TODO(jsbell): Sort by name? 192 // TODO(jsbell): Sort by name?
193 scoped_ptr<ListValue> database_list(new ListValue()); 193 scoped_ptr<base::ListValue> database_list(new base::ListValue());
194 194
195 for (std::vector<IndexedDBDatabase*>::iterator it = databases.begin(); 195 for (std::vector<IndexedDBDatabase*>::iterator it = databases.begin();
196 it != databases.end(); 196 it != databases.end();
197 ++it) { 197 ++it) {
198 198
199 const IndexedDBDatabase* db = *it; 199 const IndexedDBDatabase* db = *it;
200 scoped_ptr<DictionaryValue> db_info(new DictionaryValue()); 200 scoped_ptr<base::DictionaryValue> db_info(new base::DictionaryValue());
201 201
202 db_info->SetString("name", db->name()); 202 db_info->SetString("name", db->name());
203 db_info->SetDouble("pending_opens", db->PendingOpenCount()); 203 db_info->SetDouble("pending_opens", db->PendingOpenCount());
204 db_info->SetDouble("pending_upgrades", db->PendingUpgradeCount()); 204 db_info->SetDouble("pending_upgrades", db->PendingUpgradeCount());
205 db_info->SetDouble("running_upgrades", db->RunningUpgradeCount()); 205 db_info->SetDouble("running_upgrades", db->RunningUpgradeCount());
206 db_info->SetDouble("pending_deletes", db->PendingDeleteCount()); 206 db_info->SetDouble("pending_deletes", db->PendingDeleteCount());
207 db_info->SetDouble("connection_count", 207 db_info->SetDouble("connection_count",
208 db->ConnectionCount() - db->PendingUpgradeCount() - 208 db->ConnectionCount() - db->PendingUpgradeCount() -
209 db->RunningUpgradeCount()); 209 db->RunningUpgradeCount());
210 210
211 scoped_ptr<ListValue> transaction_list(new ListValue()); 211 scoped_ptr<base::ListValue> transaction_list(new base::ListValue());
212 std::vector<const IndexedDBTransaction*> transactions = 212 std::vector<const IndexedDBTransaction*> transactions =
213 db->transaction_coordinator().GetTransactions(); 213 db->transaction_coordinator().GetTransactions();
214 for (std::vector<const IndexedDBTransaction*>::iterator trans_it = 214 for (std::vector<const IndexedDBTransaction*>::iterator trans_it =
215 transactions.begin(); 215 transactions.begin();
216 trans_it != transactions.end(); 216 trans_it != transactions.end();
217 ++trans_it) { 217 ++trans_it) {
218 218
219 const IndexedDBTransaction* transaction = *trans_it; 219 const IndexedDBTransaction* transaction = *trans_it;
220 scoped_ptr<DictionaryValue> transaction_info(new DictionaryValue()); 220 scoped_ptr<base::DictionaryValue> transaction_info(
221 new base::DictionaryValue());
221 222
222 const char* kModes[] = { "readonly", "readwrite", "versionchange" }; 223 const char* kModes[] = { "readonly", "readwrite", "versionchange" };
223 transaction_info->SetString("mode", kModes[transaction->mode()]); 224 transaction_info->SetString("mode", kModes[transaction->mode()]);
224 switch (transaction->state()) { 225 switch (transaction->state()) {
225 case IndexedDBTransaction::CREATED: 226 case IndexedDBTransaction::CREATED:
226 transaction_info->SetString("status", "blocked"); 227 transaction_info->SetString("status", "blocked");
227 break; 228 break;
228 case IndexedDBTransaction::STARTED: 229 case IndexedDBTransaction::STARTED:
229 if (transaction->diagnostics().tasks_scheduled > 0) 230 if (transaction->diagnostics().tasks_scheduled > 0)
230 transaction_info->SetString("status", "running"); 231 transaction_info->SetString("status", "running");
(...skipping 19 matching lines...) Expand all
250 .InMillisecondsF()); 251 .InMillisecondsF());
251 transaction_info->SetDouble( 252 transaction_info->SetDouble(
252 "runtime", 253 "runtime",
253 (base::Time::Now() - transaction->diagnostics().start_time) 254 (base::Time::Now() - transaction->diagnostics().start_time)
254 .InMillisecondsF()); 255 .InMillisecondsF());
255 transaction_info->SetDouble( 256 transaction_info->SetDouble(
256 "tasks_scheduled", transaction->diagnostics().tasks_scheduled); 257 "tasks_scheduled", transaction->diagnostics().tasks_scheduled);
257 transaction_info->SetDouble( 258 transaction_info->SetDouble(
258 "tasks_completed", transaction->diagnostics().tasks_completed); 259 "tasks_completed", transaction->diagnostics().tasks_completed);
259 260
260 scoped_ptr<ListValue> scope(new ListValue()); 261 scoped_ptr<base::ListValue> scope(new base::ListValue());
261 for (std::set<int64>::const_iterator scope_it = 262 for (std::set<int64>::const_iterator scope_it =
262 transaction->scope().begin(); 263 transaction->scope().begin();
263 scope_it != transaction->scope().end(); 264 scope_it != transaction->scope().end();
264 ++scope_it) { 265 ++scope_it) {
265 IndexedDBDatabaseMetadata::ObjectStoreMap::const_iterator it = 266 IndexedDBDatabaseMetadata::ObjectStoreMap::const_iterator it =
266 db->metadata().object_stores.find(*scope_it); 267 db->metadata().object_stores.find(*scope_it);
267 if (it != db->metadata().object_stores.end()) 268 if (it != db->metadata().object_stores.end())
268 scope->AppendString(it->second.name); 269 scope->AppendString(it->second.name);
269 } 270 }
270 271
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 origin_set_.reset(); 582 origin_set_.reset();
582 origin_size_map_.clear(); 583 origin_size_map_.clear();
583 space_available_map_.clear(); 584 space_available_map_.clear();
584 } 585 }
585 586
586 base::TaskRunner* IndexedDBContextImpl::TaskRunner() const { 587 base::TaskRunner* IndexedDBContextImpl::TaskRunner() const {
587 return task_runner_; 588 return task_runner_;
588 } 589 }
589 590
590 } // namespace content 591 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_internals_ui.cc ('k') | content/browser/indexed_db/indexed_db_internals_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698