OLD | NEW |
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 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/file_path.h" | 14 #include "base/file_path.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/message_loop_proxy.h" | 16 #include "base/message_loop_proxy.h" |
17 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" |
18 #include "base/stl_util.h" | |
19 #include "base/string_number_conversions.h" | 18 #include "base/string_number_conversions.h" |
20 #include "base/sys_info.h" | 19 #include "base/sys_info.h" |
21 #include "base/time.h" | 20 #include "base/time.h" |
22 #include "net/base/net_util.h" | 21 #include "net/base/net_util.h" |
23 #include "webkit/quota/quota_database.h" | 22 #include "webkit/quota/quota_database.h" |
24 #include "webkit/quota/quota_temporary_storage_evictor.h" | 23 #include "webkit/quota/quota_temporary_storage_evictor.h" |
25 #include "webkit/quota/quota_types.h" | 24 #include "webkit/quota/quota_types.h" |
26 #include "webkit/quota/usage_tracker.h" | 25 #include "webkit/quota/usage_tracker.h" |
27 | 26 |
28 #define UMA_HISTOGRAM_MBYTES(name, sample) \ | 27 #define UMA_HISTOGRAM_MBYTES(name, sample) \ |
29 UMA_HISTOGRAM_CUSTOM_COUNTS( \ | 28 UMA_HISTOGRAM_CUSTOM_COUNTS( \ |
30 (name), static_cast<int>((sample) / kMBytes), \ | 29 (name), static_cast<int>((sample) / kMBytes), \ |
31 1, 10 * 1024 * 1024 /* 10TB */, 100) | 30 1, 10 * 1024 * 1024 /* 10TB */, 100) |
32 | 31 |
33 using base::ScopedCallbackFactory; | |
34 | |
35 namespace quota { | 32 namespace quota { |
36 | 33 |
37 namespace { | 34 namespace { |
38 | 35 |
39 const int64 kMBytes = 1024 * 1024; | 36 const int64 kMBytes = 1024 * 1024; |
40 const int kMinutesInMilliSeconds = 60 * 1000; | 37 const int kMinutesInMilliSeconds = 60 * 1000; |
41 | 38 |
42 const int64 kIncognitoDefaultTemporaryQuota = 50 * kMBytes; | 39 const int64 kIncognitoDefaultTemporaryQuota = 50 * kMBytes; |
43 const int64 kReportHistogramInterval = 60 * 60 * 1000; // 1 hour | 40 const int64 kReportHistogramInterval = 60 * 60 * 1000; // 1 hour |
44 const double kTemporaryQuotaRatioToAvail = 0.5; // 50% | 41 const double kTemporaryQuotaRatioToAvail = 0.5; // 50% |
(...skipping 24 matching lines...) Expand all Loading... |
69 | 66 |
70 const char QuotaManager::kDatabaseName[] = "QuotaManager"; | 67 const char QuotaManager::kDatabaseName[] = "QuotaManager"; |
71 | 68 |
72 const int QuotaManager::kThresholdOfErrorsToBeBlacklisted = 3; | 69 const int QuotaManager::kThresholdOfErrorsToBeBlacklisted = 3; |
73 | 70 |
74 const int QuotaManager::kEvictionIntervalInMilliSeconds = | 71 const int QuotaManager::kEvictionIntervalInMilliSeconds = |
75 30 * kMinutesInMilliSeconds; | 72 30 * kMinutesInMilliSeconds; |
76 | 73 |
77 // Callback translators. | 74 // Callback translators. |
78 void CallGetUsageAndQuotaCallback( | 75 void CallGetUsageAndQuotaCallback( |
79 QuotaManager::GetUsageAndQuotaCallback* callback, | 76 const QuotaManager::GetUsageAndQuotaCallback& callback, |
80 bool unlimited, | 77 bool unlimited, |
81 QuotaStatusCode status, | 78 QuotaStatusCode status, |
82 const QuotaAndUsage& quota_and_usage) { | 79 const QuotaAndUsage& quota_and_usage) { |
83 int64 usage = | 80 int64 usage = |
84 unlimited ? quota_and_usage.unlimited_usage : quota_and_usage.usage; | 81 unlimited ? quota_and_usage.unlimited_usage : quota_and_usage.usage; |
85 int64 quota = unlimited ? kint64max : quota_and_usage.quota; | 82 int64 quota = unlimited ? kint64max : quota_and_usage.quota; |
86 callback->Run(status, usage, quota); | 83 callback.Run(status, usage, quota); |
87 delete callback; | |
88 } | 84 } |
89 | 85 |
90 void CallQuotaCallback( | 86 void CallQuotaCallback( |
91 QuotaCallback* callback, | 87 const QuotaCallback& callback, |
92 StorageType type, | 88 StorageType type, |
93 QuotaStatusCode status, | 89 QuotaStatusCode status, |
94 const QuotaAndUsage& quota_and_usage) { | 90 const QuotaAndUsage& quota_and_usage) { |
95 callback->Run(status, type, quota_and_usage.quota); | 91 callback.Run(status, type, quota_and_usage.quota); |
96 delete callback; | |
97 } | 92 } |
98 | 93 |
99 // This class is for posting GetUsage/GetQuota tasks, gathering | 94 // This class is for posting GetUsage/GetQuota tasks, gathering |
100 // results and dispatching GetAndQuota callbacks. | 95 // results and dispatching GetAndQuota callbacks. |
101 // This class is self-destructed. | 96 // This class is self-destructed. |
102 class QuotaManager::UsageAndQuotaDispatcherTask : public QuotaTask { | 97 class QuotaManager::UsageAndQuotaDispatcherTask : public QuotaTask { |
103 public: | 98 public: |
104 typedef UsageAndQuotaDispatcherCallback Callback; | 99 typedef UsageAndQuotaDispatcherCallback Callback; |
105 typedef std::deque<Callback> CallbackList; | 100 typedef std::deque<Callback> CallbackList; |
106 | 101 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 : QuotaTask(manager), | 159 : QuotaTask(manager), |
165 host_and_type_(host_and_type), | 160 host_and_type_(host_and_type), |
166 started_(false), | 161 started_(false), |
167 host_quota_(-1), | 162 host_quota_(-1), |
168 global_usage_(-1), | 163 global_usage_(-1), |
169 global_unlimited_usage_(-1), | 164 global_unlimited_usage_(-1), |
170 host_usage_(-1), | 165 host_usage_(-1), |
171 available_space_(-1), | 166 available_space_(-1), |
172 quota_status_(kQuotaStatusUnknown), | 167 quota_status_(kQuotaStatusUnknown), |
173 waiting_callbacks_(1), | 168 waiting_callbacks_(1), |
174 ALLOW_THIS_IN_INITIALIZER_LIST(callback_factory_(this)) {} | 169 weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {} |
175 | 170 |
176 virtual ~UsageAndQuotaDispatcherTask() {} | 171 virtual ~UsageAndQuotaDispatcherTask() {} |
177 | 172 |
178 // Subclasses must implement them. | 173 // Subclasses must implement them. |
179 virtual void RunBody() = 0; | 174 virtual void RunBody() = 0; |
180 virtual void DispatchCallbacks() = 0; | 175 virtual void DispatchCallbacks() = 0; |
181 | 176 |
182 virtual void Run() OVERRIDE { | 177 virtual void Run() OVERRIDE { |
183 DCHECK(!started_); | 178 DCHECK(!started_); |
184 started_ = true; | 179 started_ = true; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 // We basically calculate the temporary quota by | 234 // We basically calculate the temporary quota by |
240 // [available_space + space_used_for_temp] * kTempQuotaRatio, | 235 // [available_space + space_used_for_temp] * kTempQuotaRatio, |
241 // but make sure we'll have no overflow. | 236 // but make sure we'll have no overflow. |
242 avail_space += limited_usage; | 237 avail_space += limited_usage; |
243 } | 238 } |
244 return avail_space * kTemporaryQuotaRatioToAvail; | 239 return avail_space * kTemporaryQuotaRatioToAvail; |
245 } | 240 } |
246 | 241 |
247 // Subclasses must call following methods to create a new 'waitable' | 242 // Subclasses must call following methods to create a new 'waitable' |
248 // callback, which decrements waiting_callbacks when it is called. | 243 // callback, which decrements waiting_callbacks when it is called. |
249 GlobalUsageCallback* NewWaitableGlobalUsageCallback() { | 244 GlobalUsageCallback NewWaitableGlobalUsageCallback() { |
250 ++waiting_callbacks_; | 245 ++waiting_callbacks_; |
251 return callback_factory_.NewCallback( | 246 return base::Bind(&UsageAndQuotaDispatcherTask::DidGetGlobalUsage, |
252 &UsageAndQuotaDispatcherTask::DidGetGlobalUsage); | 247 weak_factory_.GetWeakPtr()); |
253 } | 248 } |
254 HostUsageCallback* NewWaitableHostUsageCallback() { | 249 HostUsageCallback NewWaitableHostUsageCallback() { |
255 ++waiting_callbacks_; | 250 ++waiting_callbacks_; |
256 return callback_factory_.NewCallback( | 251 return base::Bind(&UsageAndQuotaDispatcherTask::DidGetHostUsage, |
257 &UsageAndQuotaDispatcherTask::DidGetHostUsage); | 252 weak_factory_.GetWeakPtr()); |
258 } | 253 } |
259 HostQuotaCallback* NewWaitableHostQuotaCallback() { | 254 HostQuotaCallback NewWaitableHostQuotaCallback() { |
260 ++waiting_callbacks_; | 255 ++waiting_callbacks_; |
261 return callback_factory_.NewCallback( | 256 return base::Bind(&UsageAndQuotaDispatcherTask::DidGetHostQuota, |
262 &UsageAndQuotaDispatcherTask::DidGetHostQuota); | 257 weak_factory_.GetWeakPtr()); |
263 } | 258 } |
264 AvailableSpaceCallback* NewWaitableAvailableSpaceCallback() { | 259 AvailableSpaceCallback NewWaitableAvailableSpaceCallback() { |
265 ++waiting_callbacks_; | 260 ++waiting_callbacks_; |
266 return callback_factory_.NewCallback( | 261 return base::Bind(&UsageAndQuotaDispatcherTask::DidGetAvailableSpace, |
267 &UsageAndQuotaDispatcherTask::DidGetAvailableSpace); | 262 weak_factory_.GetWeakPtr()); |
268 } | 263 } |
269 | 264 |
| 265 |
270 private: | 266 private: |
271 void CheckCompleted() { | 267 void CheckCompleted() { |
272 if (--waiting_callbacks_ <= 0) { | 268 if (--waiting_callbacks_ <= 0) { |
273 DispatchCallbacks(); | 269 DispatchCallbacks(); |
274 DCHECK(callbacks_.empty()); | 270 DCHECK(callbacks_.empty()); |
275 | 271 |
276 UsageAndQuotaDispatcherTaskMap& dispatcher_map = | 272 UsageAndQuotaDispatcherTaskMap& dispatcher_map = |
277 manager()->usage_and_quota_dispatchers_; | 273 manager()->usage_and_quota_dispatchers_; |
278 DCHECK(dispatcher_map.find(host_and_type_) != dispatcher_map.end()); | 274 DCHECK(dispatcher_map.find(host_and_type_) != dispatcher_map.end()); |
279 dispatcher_map.erase(host_and_type_); | 275 dispatcher_map.erase(host_and_type_); |
280 CallCompleted(); | 276 CallCompleted(); |
281 } | 277 } |
282 } | 278 } |
283 | 279 |
284 const std::string host_; | 280 const std::string host_; |
285 const HostAndType host_and_type_; | 281 const HostAndType host_and_type_; |
286 bool started_; | 282 bool started_; |
287 int64 host_quota_; | 283 int64 host_quota_; |
288 int64 global_usage_; | 284 int64 global_usage_; |
289 int64 global_unlimited_usage_; | 285 int64 global_unlimited_usage_; |
290 int64 host_usage_; | 286 int64 host_usage_; |
291 int64 available_space_; | 287 int64 available_space_; |
292 QuotaStatusCode quota_status_; | 288 QuotaStatusCode quota_status_; |
293 CallbackList callbacks_; | 289 CallbackList callbacks_; |
294 int waiting_callbacks_; | 290 int waiting_callbacks_; |
295 ScopedCallbackFactory<UsageAndQuotaDispatcherTask> callback_factory_; | 291 base::WeakPtrFactory<UsageAndQuotaDispatcherTask> weak_factory_; |
296 | 292 |
297 DISALLOW_COPY_AND_ASSIGN(UsageAndQuotaDispatcherTask); | 293 DISALLOW_COPY_AND_ASSIGN(UsageAndQuotaDispatcherTask); |
298 }; | 294 }; |
299 | 295 |
300 class QuotaManager::GetUsageInfoTask : public QuotaTask { | 296 class QuotaManager::GetUsageInfoTask : public QuotaTask { |
301 private: | 297 private: |
302 typedef QuotaManager::GetUsageInfoTask self_type; | 298 typedef QuotaManager::GetUsageInfoTask self_type; |
303 | 299 |
304 public: | 300 public: |
305 GetUsageInfoTask( | 301 GetUsageInfoTask( |
306 QuotaManager* manager, | 302 QuotaManager* manager, |
307 GetUsageInfoCallback* callback) | 303 const GetUsageInfoCallback& callback) |
308 : QuotaTask(manager), | 304 : QuotaTask(manager), |
309 callback_(callback), | 305 callback_(callback), |
310 ALLOW_THIS_IN_INITIALIZER_LIST(callback_factory_(this)) { | 306 weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { |
311 } | 307 } |
312 protected: | 308 protected: |
313 virtual void Run() OVERRIDE { | 309 virtual void Run() OVERRIDE { |
314 remaining_trackers_ = 2; | 310 remaining_trackers_ = 2; |
315 // This will populate cached hosts and usage info. | 311 // This will populate cached hosts and usage info. |
316 manager()->GetUsageTracker(kStorageTypeTemporary)->GetGlobalUsage( | 312 manager()->GetUsageTracker(kStorageTypeTemporary)->GetGlobalUsage( |
317 callback_factory_.NewCallback(&GetUsageInfoTask::DidGetGlobalUsage)); | 313 base::Bind(&GetUsageInfoTask::DidGetGlobalUsage, |
| 314 weak_factory_.GetWeakPtr())); |
318 manager()->GetUsageTracker(kStorageTypePersistent)->GetGlobalUsage( | 315 manager()->GetUsageTracker(kStorageTypePersistent)->GetGlobalUsage( |
319 callback_factory_.NewCallback(&GetUsageInfoTask::DidGetGlobalUsage)); | 316 base::Bind(&GetUsageInfoTask::DidGetGlobalUsage, |
| 317 weak_factory_.GetWeakPtr())); |
320 } | 318 } |
321 | 319 |
322 virtual void Completed() OVERRIDE { | 320 virtual void Completed() OVERRIDE { |
323 callback_->Run(entries_); | 321 callback_.Run(entries_); |
324 DeleteSoon(); | 322 DeleteSoon(); |
325 } | 323 } |
326 | 324 |
327 virtual void Aborted() OVERRIDE { | 325 virtual void Aborted() OVERRIDE { |
328 callback_->Run(UsageInfoEntries()); | 326 callback_.Run(UsageInfoEntries()); |
329 DeleteSoon(); | 327 DeleteSoon(); |
330 } | 328 } |
331 | 329 |
332 private: | 330 private: |
333 void AddEntries(StorageType type, UsageTracker* tracker) { | 331 void AddEntries(StorageType type, UsageTracker* tracker) { |
334 std::map<std::string, int64> host_usage; | 332 std::map<std::string, int64> host_usage; |
335 tracker->GetCachedHostsUsage(&host_usage); | 333 tracker->GetCachedHostsUsage(&host_usage); |
336 for (std::map<std::string, int64>::const_iterator iter = host_usage.begin(); | 334 for (std::map<std::string, int64>::const_iterator iter = host_usage.begin(); |
337 iter != host_usage.end(); | 335 iter != host_usage.end(); |
338 ++iter) { | 336 ++iter) { |
339 entries_.push_back(UsageInfo(iter->first, type, iter->second)); | 337 entries_.push_back(UsageInfo(iter->first, type, iter->second)); |
340 } | 338 } |
341 if (--remaining_trackers_ == 0) | 339 if (--remaining_trackers_ == 0) |
342 CallCompleted(); | 340 CallCompleted(); |
343 } | 341 } |
344 | 342 |
345 void DidGetGlobalUsage(StorageType type, int64, int64) { | 343 void DidGetGlobalUsage(StorageType type, int64, int64) { |
346 AddEntries(type, manager()->GetUsageTracker(type)); | 344 AddEntries(type, manager()->GetUsageTracker(type)); |
347 } | 345 } |
348 | 346 |
349 QuotaManager* manager() const { | 347 QuotaManager* manager() const { |
350 return static_cast<QuotaManager*>(observer()); | 348 return static_cast<QuotaManager*>(observer()); |
351 } | 349 } |
352 | 350 |
353 scoped_ptr<GetUsageInfoCallback> callback_; | 351 GetUsageInfoCallback callback_; |
354 UsageInfoEntries entries_; | 352 UsageInfoEntries entries_; |
355 base::ScopedCallbackFactory<GetUsageInfoTask> callback_factory_; | 353 base::WeakPtrFactory<GetUsageInfoTask> weak_factory_; |
356 int remaining_trackers_; | 354 int remaining_trackers_; |
357 | 355 |
358 DISALLOW_COPY_AND_ASSIGN(GetUsageInfoTask); | 356 DISALLOW_COPY_AND_ASSIGN(GetUsageInfoTask); |
359 }; | 357 }; |
360 | 358 |
361 class QuotaManager::UsageAndQuotaDispatcherTaskForTemporary | 359 class QuotaManager::UsageAndQuotaDispatcherTaskForTemporary |
362 : public QuotaManager::UsageAndQuotaDispatcherTask { | 360 : public QuotaManager::UsageAndQuotaDispatcherTask { |
363 public: | 361 public: |
364 UsageAndQuotaDispatcherTaskForTemporary( | 362 UsageAndQuotaDispatcherTaskForTemporary( |
365 QuotaManager* manager, const HostAndType& host_and_type) | 363 QuotaManager* manager, const HostAndType& host_and_type) |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 NOTREACHED(); | 455 NOTREACHED(); |
458 } | 456 } |
459 return NULL; | 457 return NULL; |
460 } | 458 } |
461 | 459 |
462 class QuotaManager::OriginDataDeleter : public QuotaTask { | 460 class QuotaManager::OriginDataDeleter : public QuotaTask { |
463 public: | 461 public: |
464 OriginDataDeleter(QuotaManager* manager, | 462 OriginDataDeleter(QuotaManager* manager, |
465 const GURL& origin, | 463 const GURL& origin, |
466 StorageType type, | 464 StorageType type, |
467 StatusCallback* callback) | 465 const StatusCallback& callback) |
468 : QuotaTask(manager), | 466 : QuotaTask(manager), |
469 origin_(origin), | 467 origin_(origin), |
470 type_(type), | 468 type_(type), |
471 error_count_(0), | 469 error_count_(0), |
472 remaining_clients_(-1), | 470 remaining_clients_(-1), |
473 callback_(callback), | 471 callback_(callback), |
474 ALLOW_THIS_IN_INITIALIZER_LIST(callback_factory_(this)) {} | 472 weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {} |
475 | 473 |
476 protected: | 474 protected: |
477 virtual void Run() OVERRIDE { | 475 virtual void Run() OVERRIDE { |
478 error_count_ = 0; | 476 error_count_ = 0; |
479 remaining_clients_ = manager()->clients_.size(); | 477 remaining_clients_ = manager()->clients_.size(); |
480 for (QuotaClientList::iterator iter = manager()->clients_.begin(); | 478 for (QuotaClientList::iterator iter = manager()->clients_.begin(); |
481 iter != manager()->clients_.end(); ++iter) { | 479 iter != manager()->clients_.end(); ++iter) { |
482 (*iter)->DeleteOriginData(origin_, type_, callback_factory_.NewCallback( | 480 (*iter)->DeleteOriginData( |
483 &OriginDataDeleter::DidDeleteOriginData)); | 481 origin_, type_, |
| 482 base::Bind(&OriginDataDeleter::DidDeleteOriginData, |
| 483 weak_factory_.GetWeakPtr())); |
484 } | 484 } |
485 } | 485 } |
486 | 486 |
487 virtual void Completed() OVERRIDE { | 487 virtual void Completed() OVERRIDE { |
488 if (error_count_ == 0) { | 488 if (error_count_ == 0) { |
489 manager()->DeleteOriginFromDatabase(origin_, type_); | 489 manager()->DeleteOriginFromDatabase(origin_, type_); |
490 callback_->Run(kQuotaStatusOk); | 490 callback_.Run(kQuotaStatusOk); |
491 } else { | 491 } else { |
492 callback_->Run(kQuotaErrorInvalidModification); | 492 callback_.Run(kQuotaErrorInvalidModification); |
493 } | 493 } |
494 DeleteSoon(); | 494 DeleteSoon(); |
495 } | 495 } |
496 | 496 |
497 virtual void Aborted() OVERRIDE { | 497 virtual void Aborted() OVERRIDE { |
498 callback_->Run(kQuotaErrorAbort); | 498 callback_.Run(kQuotaErrorAbort); |
499 DeleteSoon(); | 499 DeleteSoon(); |
500 } | 500 } |
501 | 501 |
502 void DidDeleteOriginData(QuotaStatusCode status) { | 502 void DidDeleteOriginData(QuotaStatusCode status) { |
503 DCHECK_GT(remaining_clients_, 0); | 503 DCHECK_GT(remaining_clients_, 0); |
504 | 504 |
505 if (status != kQuotaStatusOk) | 505 if (status != kQuotaStatusOk) |
506 ++error_count_; | 506 ++error_count_; |
507 | 507 |
508 if (--remaining_clients_ == 0) | 508 if (--remaining_clients_ == 0) |
509 CallCompleted(); | 509 CallCompleted(); |
510 } | 510 } |
511 | 511 |
512 QuotaManager* manager() const { | 512 QuotaManager* manager() const { |
513 return static_cast<QuotaManager*>(observer()); | 513 return static_cast<QuotaManager*>(observer()); |
514 } | 514 } |
515 | 515 |
516 GURL origin_; | 516 GURL origin_; |
517 StorageType type_; | 517 StorageType type_; |
518 int error_count_; | 518 int error_count_; |
519 int remaining_clients_; | 519 int remaining_clients_; |
520 scoped_ptr<StatusCallback> callback_; | 520 StatusCallback callback_; |
521 | 521 |
522 ScopedCallbackFactory<OriginDataDeleter> callback_factory_; | 522 base::WeakPtrFactory<OriginDataDeleter> weak_factory_; |
523 DISALLOW_COPY_AND_ASSIGN(OriginDataDeleter); | 523 DISALLOW_COPY_AND_ASSIGN(OriginDataDeleter); |
524 }; | 524 }; |
525 | 525 |
526 class QuotaManager::DatabaseTaskBase : public QuotaThreadTask { | 526 class QuotaManager::DatabaseTaskBase : public QuotaThreadTask { |
527 public: | 527 public: |
528 explicit DatabaseTaskBase(QuotaManager* manager) | 528 explicit DatabaseTaskBase(QuotaManager* manager) |
529 : QuotaThreadTask(manager, manager->db_thread_), | 529 : QuotaThreadTask(manager, manager->db_thread_), |
530 manager_(manager), | 530 manager_(manager), |
531 database_(manager->database_.get()), | 531 database_(manager->database_.get()), |
532 db_disabled_(false) { | 532 db_disabled_(false) { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 int64 temporary_quota_override_; | 585 int64 temporary_quota_override_; |
586 int64 desired_available_space_; | 586 int64 desired_available_space_; |
587 }; | 587 }; |
588 | 588 |
589 class QuotaManager::UpdateTemporaryQuotaOverrideTask | 589 class QuotaManager::UpdateTemporaryQuotaOverrideTask |
590 : public QuotaManager::DatabaseTaskBase { | 590 : public QuotaManager::DatabaseTaskBase { |
591 public: | 591 public: |
592 UpdateTemporaryQuotaOverrideTask( | 592 UpdateTemporaryQuotaOverrideTask( |
593 QuotaManager* manager, | 593 QuotaManager* manager, |
594 int64 new_quota, | 594 int64 new_quota, |
595 QuotaCallback* callback) | 595 const QuotaCallback& callback) |
596 : DatabaseTaskBase(manager), | 596 : DatabaseTaskBase(manager), |
597 new_quota_(new_quota), | 597 new_quota_(new_quota), |
598 callback_(callback) {} | 598 callback_(callback) {} |
599 | 599 |
600 protected: | 600 protected: |
601 virtual void RunOnTargetThread() OVERRIDE { | 601 virtual void RunOnTargetThread() OVERRIDE { |
602 if (!database()->SetQuotaConfigValue( | 602 if (!database()->SetQuotaConfigValue( |
603 QuotaDatabase::kTemporaryQuotaOverrideKey, new_quota_)) { | 603 QuotaDatabase::kTemporaryQuotaOverrideKey, new_quota_)) { |
604 set_db_disabled(true); | 604 set_db_disabled(true); |
605 new_quota_ = -1; | 605 new_quota_ = -1; |
606 return; | 606 return; |
607 } | 607 } |
608 } | 608 } |
609 | 609 |
610 virtual void DatabaseTaskCompleted() OVERRIDE { | 610 virtual void DatabaseTaskCompleted() OVERRIDE { |
611 if (!db_disabled()) { | 611 if (!db_disabled()) { |
612 manager()->temporary_quota_override_ = new_quota_; | 612 manager()->temporary_quota_override_ = new_quota_; |
613 CallCallback(kQuotaStatusOk, kStorageTypeTemporary, new_quota_); | 613 CallCallback(kQuotaStatusOk, kStorageTypeTemporary, new_quota_); |
614 } else { | 614 } else { |
615 CallCallback(kQuotaErrorInvalidAccess, kStorageTypeTemporary, new_quota_); | 615 CallCallback(kQuotaErrorInvalidAccess, kStorageTypeTemporary, new_quota_); |
616 } | 616 } |
617 } | 617 } |
618 | 618 |
619 private: | 619 private: |
620 void CallCallback(QuotaStatusCode status, StorageType type, int64 quota) { | 620 void CallCallback(QuotaStatusCode status, StorageType type, int64 quota) { |
621 if (callback_.get()) { | 621 if (!callback_.is_null()) { |
622 callback_->Run(status, type, quota); | 622 callback_.Run(status, type, quota); |
623 callback_.reset(); | 623 callback_.Reset(); |
624 } | 624 } |
625 } | 625 } |
626 | 626 |
627 int64 new_quota_; | 627 int64 new_quota_; |
628 scoped_ptr<QuotaCallback> callback_; | 628 QuotaCallback callback_; |
629 }; | 629 }; |
630 | 630 |
631 class QuotaManager::GetPersistentHostQuotaTask | 631 class QuotaManager::GetPersistentHostQuotaTask |
632 : public QuotaManager::DatabaseTaskBase { | 632 : public QuotaManager::DatabaseTaskBase { |
633 public: | 633 public: |
634 GetPersistentHostQuotaTask( | 634 GetPersistentHostQuotaTask( |
635 QuotaManager* manager, | 635 QuotaManager* manager, |
636 const std::string& host, | 636 const std::string& host, |
637 HostQuotaCallback* callback) | 637 const HostQuotaCallback& callback) |
638 : DatabaseTaskBase(manager), | 638 : DatabaseTaskBase(manager), |
639 host_(host), | 639 host_(host), |
640 quota_(-1), | 640 quota_(-1), |
641 callback_(callback) { | 641 callback_(callback) { |
642 } | 642 } |
643 protected: | 643 protected: |
644 virtual void RunOnTargetThread() OVERRIDE { | 644 virtual void RunOnTargetThread() OVERRIDE { |
645 if (!database()->GetHostQuota(host_, kStorageTypePersistent, "a_)) | 645 if (!database()->GetHostQuota(host_, kStorageTypePersistent, "a_)) |
646 quota_ = 0; | 646 quota_ = 0; |
647 } | 647 } |
648 virtual void DatabaseTaskCompleted() OVERRIDE { | 648 virtual void DatabaseTaskCompleted() OVERRIDE { |
649 callback_->Run(kQuotaStatusOk, | 649 callback_.Run(kQuotaStatusOk, |
650 host_, kStorageTypePersistent, quota_); | 650 host_, kStorageTypePersistent, quota_); |
651 } | 651 } |
652 private: | 652 private: |
653 std::string host_; | 653 std::string host_; |
654 int64 quota_; | 654 int64 quota_; |
655 scoped_ptr<HostQuotaCallback> callback_; | 655 HostQuotaCallback callback_; |
656 }; | 656 }; |
657 | 657 |
658 class QuotaManager::UpdatePersistentHostQuotaTask | 658 class QuotaManager::UpdatePersistentHostQuotaTask |
659 : public QuotaManager::DatabaseTaskBase { | 659 : public QuotaManager::DatabaseTaskBase { |
660 public: | 660 public: |
661 UpdatePersistentHostQuotaTask( | 661 UpdatePersistentHostQuotaTask( |
662 QuotaManager* manager, | 662 QuotaManager* manager, |
663 const std::string& host, | 663 const std::string& host, |
664 int new_quota, | 664 int new_quota, |
665 HostQuotaCallback* callback) | 665 const HostQuotaCallback& callback) |
666 : DatabaseTaskBase(manager), | 666 : DatabaseTaskBase(manager), |
667 host_(host), | 667 host_(host), |
668 new_quota_(new_quota), | 668 new_quota_(new_quota), |
669 callback_(callback) { | 669 callback_(callback) { |
670 DCHECK_GE(new_quota_, 0); | 670 DCHECK_GE(new_quota_, 0); |
671 } | 671 } |
672 protected: | 672 protected: |
673 virtual void RunOnTargetThread() OVERRIDE { | 673 virtual void RunOnTargetThread() OVERRIDE { |
674 if (!database()->SetHostQuota(host_, kStorageTypePersistent, new_quota_)) { | 674 if (!database()->SetHostQuota(host_, kStorageTypePersistent, new_quota_)) { |
675 set_db_disabled(true); | 675 set_db_disabled(true); |
676 new_quota_ = 0; | 676 new_quota_ = 0; |
677 } | 677 } |
678 } | 678 } |
679 | 679 |
680 virtual void DatabaseTaskCompleted() OVERRIDE { | 680 virtual void DatabaseTaskCompleted() OVERRIDE { |
681 callback_->Run(db_disabled() ? kQuotaErrorInvalidAccess : kQuotaStatusOk, | 681 callback_.Run(db_disabled() ? kQuotaErrorInvalidAccess : kQuotaStatusOk, |
682 host_, kStorageTypePersistent, new_quota_); | 682 host_, kStorageTypePersistent, new_quota_); |
683 } | 683 } |
684 | 684 |
685 virtual void Aborted() OVERRIDE { | 685 virtual void Aborted() OVERRIDE { |
686 callback_.reset(); | 686 callback_.Reset(); |
687 } | 687 } |
688 | 688 |
689 private: | 689 private: |
690 std::string host_; | 690 std::string host_; |
691 int64 new_quota_; | 691 int64 new_quota_; |
692 scoped_ptr<HostQuotaCallback> callback_; | 692 HostQuotaCallback callback_; |
693 }; | 693 }; |
694 | 694 |
695 class QuotaManager::GetLRUOriginTask | 695 class QuotaManager::GetLRUOriginTask |
696 : public QuotaManager::DatabaseTaskBase { | 696 : public QuotaManager::DatabaseTaskBase { |
697 public: | 697 public: |
698 GetLRUOriginTask( | 698 GetLRUOriginTask( |
699 QuotaManager* manager, | 699 QuotaManager* manager, |
700 StorageType type, | 700 StorageType type, |
701 const std::map<GURL, int>& origins_in_use, | 701 const std::map<GURL, int>& origins_in_use, |
702 const std::map<GURL, int>& origins_in_error, | 702 const std::map<GURL, int>& origins_in_error, |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 | 797 |
798 private: | 798 private: |
799 std::set<GURL> origins_; | 799 std::set<GURL> origins_; |
800 bool has_registered_origins_; | 800 bool has_registered_origins_; |
801 }; | 801 }; |
802 | 802 |
803 class QuotaManager::AvailableSpaceQueryTask : public QuotaThreadTask { | 803 class QuotaManager::AvailableSpaceQueryTask : public QuotaThreadTask { |
804 public: | 804 public: |
805 AvailableSpaceQueryTask( | 805 AvailableSpaceQueryTask( |
806 QuotaManager* manager, | 806 QuotaManager* manager, |
807 AvailableSpaceCallback* callback) | 807 const AvailableSpaceCallback& callback) |
808 : QuotaThreadTask(manager, manager->db_thread_), | 808 : QuotaThreadTask(manager, manager->db_thread_), |
809 profile_path_(manager->profile_path_), | 809 profile_path_(manager->profile_path_), |
810 space_(-1), | 810 space_(-1), |
811 callback_(callback) { | 811 callback_(callback) { |
812 } | 812 } |
813 virtual ~AvailableSpaceQueryTask() {} | 813 virtual ~AvailableSpaceQueryTask() {} |
814 | 814 |
815 protected: | 815 protected: |
816 virtual void RunOnTargetThread() OVERRIDE { | 816 virtual void RunOnTargetThread() OVERRIDE { |
817 space_ = base::SysInfo::AmountOfFreeDiskSpace(profile_path_); | 817 space_ = base::SysInfo::AmountOfFreeDiskSpace(profile_path_); |
818 } | 818 } |
819 | 819 |
820 virtual void Aborted() OVERRIDE { | 820 virtual void Aborted() OVERRIDE { |
821 callback_.reset(); | 821 callback_.Reset(); |
822 } | 822 } |
823 | 823 |
824 virtual void Completed() OVERRIDE { | 824 virtual void Completed() OVERRIDE { |
825 callback_->Run(kQuotaStatusOk, space_); | 825 callback_.Run(kQuotaStatusOk, space_); |
826 } | 826 } |
827 | 827 |
828 private: | 828 private: |
829 FilePath profile_path_; | 829 FilePath profile_path_; |
830 int64 space_; | 830 int64 space_; |
831 scoped_ptr<AvailableSpaceCallback> callback_; | 831 AvailableSpaceCallback callback_; |
832 }; | 832 }; |
833 | 833 |
834 class QuotaManager::UpdateAccessTimeTask | 834 class QuotaManager::UpdateAccessTimeTask |
835 : public QuotaManager::DatabaseTaskBase { | 835 : public QuotaManager::DatabaseTaskBase { |
836 public: | 836 public: |
837 UpdateAccessTimeTask( | 837 UpdateAccessTimeTask( |
838 QuotaManager* manager, | 838 QuotaManager* manager, |
839 const GURL& origin, | 839 const GURL& origin, |
840 StorageType type, | 840 StorageType type, |
841 base::Time accessed_time) | 841 base::Time accessed_time) |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
886 base::Time modified_time_; | 886 base::Time modified_time_; |
887 }; | 887 }; |
888 | 888 |
889 class QuotaManager::GetModifiedSinceTask | 889 class QuotaManager::GetModifiedSinceTask |
890 : public QuotaManager::DatabaseTaskBase { | 890 : public QuotaManager::DatabaseTaskBase { |
891 public: | 891 public: |
892 GetModifiedSinceTask( | 892 GetModifiedSinceTask( |
893 QuotaManager* manager, | 893 QuotaManager* manager, |
894 StorageType type, | 894 StorageType type, |
895 base::Time modified_since, | 895 base::Time modified_since, |
896 GetOriginsCallback* callback) | 896 GetOriginsCallback callback) |
897 : DatabaseTaskBase(manager), | 897 : DatabaseTaskBase(manager), |
898 type_(type), | 898 type_(type), |
899 modified_since_(modified_since), | 899 modified_since_(modified_since), |
900 callback_(callback) {} | 900 callback_(callback) {} |
901 | 901 |
902 protected: | 902 protected: |
903 virtual void RunOnTargetThread() OVERRIDE { | 903 virtual void RunOnTargetThread() OVERRIDE { |
904 if (!database()->GetOriginsModifiedSince( | 904 if (!database()->GetOriginsModifiedSince( |
905 type_, &origins_, modified_since_)) { | 905 type_, &origins_, modified_since_)) { |
906 set_db_disabled(true); | 906 set_db_disabled(true); |
907 } | 907 } |
908 } | 908 } |
909 | 909 |
910 virtual void DatabaseTaskCompleted() OVERRIDE { | 910 virtual void DatabaseTaskCompleted() OVERRIDE { |
911 callback_->Run(origins_, type_); | 911 callback_.Run(origins_, type_); |
912 } | 912 } |
913 | 913 |
914 virtual void Aborted() OVERRIDE { | 914 virtual void Aborted() OVERRIDE { |
915 callback_->Run(std::set<GURL>(), type_); | 915 callback_.Run(std::set<GURL>(), type_); |
916 } | 916 } |
917 | 917 |
918 private: | 918 private: |
919 StorageType type_; | 919 StorageType type_; |
920 base::Time modified_since_; | 920 base::Time modified_since_; |
921 std::set<GURL> origins_; | 921 std::set<GURL> origins_; |
922 scoped_ptr<GetOriginsCallback> callback_; | 922 GetOriginsCallback callback_; |
923 }; | 923 }; |
924 | 924 |
925 class QuotaManager::DumpQuotaTableTask | 925 class QuotaManager::DumpQuotaTableTask |
926 : public QuotaManager::DatabaseTaskBase { | 926 : public QuotaManager::DatabaseTaskBase { |
927 private: | 927 private: |
928 typedef QuotaManager::DumpQuotaTableTask self_type; | 928 typedef QuotaManager::DumpQuotaTableTask self_type; |
929 typedef QuotaManager::DumpQuotaTableCallback Callback; | 929 typedef QuotaManager::DumpQuotaTableCallback Callback; |
930 typedef QuotaManager::QuotaTableEntry TableEntry; | 930 typedef QuotaManager::QuotaTableEntry TableEntry; |
931 typedef QuotaManager::QuotaTableEntries TableEntries; | 931 typedef QuotaManager::QuotaTableEntries TableEntries; |
932 typedef QuotaDatabase::QuotaTableCallback TableCallback; | 932 typedef QuotaDatabase::QuotaTableCallback TableCallback; |
933 | 933 |
934 public: | 934 public: |
935 DumpQuotaTableTask( | 935 DumpQuotaTableTask( |
936 QuotaManager* manager, | 936 QuotaManager* manager, |
937 Callback* callback) | 937 const Callback& callback) |
938 : DatabaseTaskBase(manager), | 938 : DatabaseTaskBase(manager), |
939 callback_(callback) { | 939 callback_(callback) { |
940 } | 940 } |
941 protected: | 941 protected: |
942 virtual void RunOnTargetThread() OVERRIDE { | 942 virtual void RunOnTargetThread() OVERRIDE { |
943 if (!database()->DumpQuotaTable( | 943 if (!database()->DumpQuotaTable( |
944 new TableCallback( | 944 new TableCallback( |
945 base::Bind(&self_type::AppendEntry, this)))) | 945 base::Bind(&self_type::AppendEntry, this)))) |
946 set_db_disabled(true); | 946 set_db_disabled(true); |
947 } | 947 } |
948 | 948 |
949 virtual void Aborted() OVERRIDE { | 949 virtual void Aborted() OVERRIDE { |
950 callback_->Run(TableEntries()); | 950 callback_.Run(TableEntries()); |
951 } | 951 } |
952 | 952 |
953 virtual void DatabaseTaskCompleted() OVERRIDE { | 953 virtual void DatabaseTaskCompleted() OVERRIDE { |
954 callback_->Run(entries_); | 954 callback_.Run(entries_); |
955 } | 955 } |
956 | 956 |
957 private: | 957 private: |
958 bool AppendEntry(const TableEntry& entry) { | 958 bool AppendEntry(const TableEntry& entry) { |
959 entries_.push_back(entry); | 959 entries_.push_back(entry); |
960 return true; | 960 return true; |
961 } | 961 } |
962 | 962 |
963 scoped_ptr<Callback> callback_; | 963 Callback callback_; |
964 TableEntries entries_; | 964 TableEntries entries_; |
965 }; | 965 }; |
966 | 966 |
967 class QuotaManager::DumpOriginInfoTableTask | 967 class QuotaManager::DumpOriginInfoTableTask |
968 : public QuotaManager::DatabaseTaskBase { | 968 : public QuotaManager::DatabaseTaskBase { |
969 private: | 969 private: |
970 typedef QuotaManager::DumpOriginInfoTableTask self_type; | 970 typedef QuotaManager::DumpOriginInfoTableTask self_type; |
971 typedef QuotaManager::DumpOriginInfoTableCallback Callback; | 971 typedef QuotaManager::DumpOriginInfoTableCallback Callback; |
972 typedef QuotaManager::OriginInfoTableEntry TableEntry; | 972 typedef QuotaManager::OriginInfoTableEntry TableEntry; |
973 typedef QuotaManager::OriginInfoTableEntries TableEntries; | 973 typedef QuotaManager::OriginInfoTableEntries TableEntries; |
974 typedef QuotaDatabase::OriginInfoTableCallback TableCallback; | 974 typedef QuotaDatabase::OriginInfoTableCallback TableCallback; |
975 | 975 |
976 public: | 976 public: |
977 DumpOriginInfoTableTask( | 977 DumpOriginInfoTableTask( |
978 QuotaManager* manager, | 978 QuotaManager* manager, |
979 Callback* callback) | 979 const Callback& callback) |
980 : DatabaseTaskBase(manager), | 980 : DatabaseTaskBase(manager), |
981 callback_(callback) { | 981 callback_(callback) { |
982 } | 982 } |
983 protected: | 983 protected: |
984 virtual void RunOnTargetThread() OVERRIDE { | 984 virtual void RunOnTargetThread() OVERRIDE { |
985 if (!database()->DumpOriginInfoTable( | 985 if (!database()->DumpOriginInfoTable( |
986 new TableCallback( | 986 new TableCallback( |
987 base::Bind(&self_type::AppendEntry, this)))) | 987 base::Bind(&self_type::AppendEntry, this)))) |
988 set_db_disabled(true); | 988 set_db_disabled(true); |
989 } | 989 } |
990 | 990 |
991 virtual void Aborted() OVERRIDE { | 991 virtual void Aborted() OVERRIDE { |
992 callback_->Run(TableEntries()); | 992 callback_.Run(TableEntries()); |
993 } | 993 } |
994 | 994 |
995 virtual void DatabaseTaskCompleted() OVERRIDE { | 995 virtual void DatabaseTaskCompleted() OVERRIDE { |
996 callback_->Run(entries_); | 996 callback_.Run(entries_); |
997 } | 997 } |
998 | 998 |
999 private: | 999 private: |
1000 bool AppendEntry(const TableEntry& entry) { | 1000 bool AppendEntry(const TableEntry& entry) { |
1001 entries_.push_back(entry); | 1001 entries_.push_back(entry); |
1002 return true; | 1002 return true; |
1003 } | 1003 } |
1004 | 1004 |
1005 scoped_ptr<Callback> callback_; | 1005 Callback callback_; |
1006 TableEntries entries_; | 1006 TableEntries entries_; |
1007 }; | 1007 }; |
1008 | 1008 |
1009 // QuotaManager --------------------------------------------------------------- | 1009 // QuotaManager --------------------------------------------------------------- |
1010 | 1010 |
1011 QuotaManager::QuotaManager(bool is_incognito, | 1011 QuotaManager::QuotaManager(bool is_incognito, |
1012 const FilePath& profile_path, | 1012 const FilePath& profile_path, |
1013 base::MessageLoopProxy* io_thread, | 1013 base::MessageLoopProxy* io_thread, |
1014 base::MessageLoopProxy* db_thread, | 1014 base::MessageLoopProxy* db_thread, |
1015 SpecialStoragePolicy* special_storage_policy) | 1015 SpecialStoragePolicy* special_storage_policy) |
1016 : is_incognito_(is_incognito), | 1016 : is_incognito_(is_incognito), |
1017 profile_path_(profile_path), | 1017 profile_path_(profile_path), |
1018 proxy_(new QuotaManagerProxy( | 1018 proxy_(new QuotaManagerProxy( |
1019 ALLOW_THIS_IN_INITIALIZER_LIST(this), io_thread)), | 1019 ALLOW_THIS_IN_INITIALIZER_LIST(this), io_thread)), |
1020 db_disabled_(false), | 1020 db_disabled_(false), |
1021 eviction_disabled_(false), | 1021 eviction_disabled_(false), |
1022 io_thread_(io_thread), | 1022 io_thread_(io_thread), |
1023 db_thread_(db_thread), | 1023 db_thread_(db_thread), |
1024 temporary_quota_initialized_(false), | 1024 temporary_quota_initialized_(false), |
1025 temporary_quota_override_(-1), | 1025 temporary_quota_override_(-1), |
1026 desired_available_space_(-1), | 1026 desired_available_space_(-1), |
1027 special_storage_policy_(special_storage_policy), | 1027 special_storage_policy_(special_storage_policy), |
1028 ALLOW_THIS_IN_INITIALIZER_LIST(callback_factory_(this)), | 1028 weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { |
1029 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { | |
1030 } | 1029 } |
1031 | 1030 |
1032 QuotaManager::~QuotaManager() { | 1031 QuotaManager::~QuotaManager() { |
1033 DCHECK(io_thread_->BelongsToCurrentThread()); | 1032 DCHECK(io_thread_->BelongsToCurrentThread()); |
1034 proxy_->manager_ = NULL; | 1033 proxy_->manager_ = NULL; |
1035 std::for_each(clients_.begin(), clients_.end(), | 1034 std::for_each(clients_.begin(), clients_.end(), |
1036 std::mem_fun(&QuotaClient::OnQuotaManagerDestroyed)); | 1035 std::mem_fun(&QuotaClient::OnQuotaManagerDestroyed)); |
1037 if (database_.get()) | 1036 if (database_.get()) |
1038 db_thread_->DeleteSoon(FROM_HERE, database_.release()); | 1037 db_thread_->DeleteSoon(FROM_HERE, database_.release()); |
1039 } | 1038 } |
1040 | 1039 |
1041 void QuotaManager::GetUsageInfo(GetUsageInfoCallback* callback) { | 1040 void QuotaManager::GetUsageInfo(const GetUsageInfoCallback& callback) { |
1042 LazyInitialize(); | 1041 LazyInitialize(); |
1043 GetUsageInfoTask* get_usage_info = new GetUsageInfoTask(this, callback); | 1042 GetUsageInfoTask* get_usage_info = new GetUsageInfoTask(this, callback); |
1044 get_usage_info->Start(); | 1043 get_usage_info->Start(); |
1045 } | 1044 } |
1046 | 1045 |
1047 void QuotaManager::GetUsageAndQuota( | 1046 void QuotaManager::GetUsageAndQuota( |
1048 const GURL& origin, StorageType type, | 1047 const GURL& origin, StorageType type, |
1049 GetUsageAndQuotaCallback* callback) { | 1048 const GetUsageAndQuotaCallback& callback) { |
1050 GetUsageAndQuotaInternal(origin, type, false /* global */, | 1049 GetUsageAndQuotaInternal(origin, type, false /* global */, |
1051 base::Bind(&CallGetUsageAndQuotaCallback, | 1050 base::Bind(&CallGetUsageAndQuotaCallback, |
1052 callback, IsStorageUnlimited(origin))); | 1051 callback, IsStorageUnlimited(origin))); |
1053 } | 1052 } |
1054 | 1053 |
1055 void QuotaManager::GetAvailableSpace(AvailableSpaceCallback* callback) { | 1054 void QuotaManager::GetAvailableSpace(const AvailableSpaceCallback& callback) { |
1056 if (is_incognito_) { | 1055 if (is_incognito_) { |
1057 callback->Run(kQuotaStatusOk, kIncognitoDefaultTemporaryQuota); | 1056 callback.Run(kQuotaStatusOk, kIncognitoDefaultTemporaryQuota); |
1058 delete callback; | |
1059 return; | 1057 return; |
1060 } | 1058 } |
1061 make_scoped_refptr(new AvailableSpaceQueryTask(this, callback))->Start(); | 1059 make_scoped_refptr(new AvailableSpaceQueryTask(this, callback))->Start(); |
1062 } | 1060 } |
1063 | 1061 |
1064 void QuotaManager::GetTemporaryGlobalQuota(QuotaCallback* callback) { | 1062 void QuotaManager::GetTemporaryGlobalQuota(const QuotaCallback& callback) { |
1065 if (temporary_quota_override_ > 0) { | 1063 if (temporary_quota_override_ > 0) { |
1066 callback->Run(kQuotaStatusOk, kStorageTypeTemporary, | 1064 callback.Run(kQuotaStatusOk, kStorageTypeTemporary, |
1067 temporary_quota_override_); | 1065 temporary_quota_override_); |
1068 delete callback; | |
1069 return; | 1066 return; |
1070 } | 1067 } |
1071 GetUsageAndQuotaInternal( | 1068 GetUsageAndQuotaInternal( |
1072 GURL(), kStorageTypeTemporary, true /* global */, | 1069 GURL(), kStorageTypeTemporary, true /* global */, |
1073 base::Bind(&CallQuotaCallback, callback, kStorageTypeTemporary)); | 1070 base::Bind(&CallQuotaCallback, callback, kStorageTypeTemporary)); |
1074 } | 1071 } |
1075 | 1072 |
1076 void QuotaManager::SetTemporaryGlobalOverrideQuota( | 1073 void QuotaManager::SetTemporaryGlobalOverrideQuota( |
1077 int64 new_quota, QuotaCallback* callback_ptr) { | 1074 int64 new_quota, const QuotaCallback& callback) { |
1078 scoped_ptr<QuotaCallback> callback(callback_ptr); | |
1079 LazyInitialize(); | 1075 LazyInitialize(); |
1080 | 1076 |
1081 if (new_quota < 0) { | 1077 if (new_quota < 0) { |
1082 if (callback.get()) | 1078 if (!callback.is_null()) |
1083 callback->Run(kQuotaErrorInvalidModification, | 1079 callback.Run(kQuotaErrorInvalidModification, |
1084 kStorageTypeTemporary, -1); | 1080 kStorageTypeTemporary, -1); |
1085 return; | 1081 return; |
1086 } | 1082 } |
1087 | 1083 |
1088 if (db_disabled_) { | 1084 if (db_disabled_) { |
1089 if (callback.get()) | 1085 if (callback.is_null()) |
1090 callback->Run(kQuotaErrorInvalidAccess, | 1086 callback.Run(kQuotaErrorInvalidAccess, |
1091 kStorageTypeTemporary, -1); | 1087 kStorageTypeTemporary, -1); |
1092 return; | 1088 return; |
1093 } | 1089 } |
1094 | 1090 |
1095 make_scoped_refptr(new UpdateTemporaryQuotaOverrideTask( | 1091 make_scoped_refptr(new UpdateTemporaryQuotaOverrideTask( |
1096 this, new_quota, callback.release()))->Start(); | 1092 this, new_quota, callback))->Start(); |
1097 } | 1093 } |
1098 | 1094 |
1099 void QuotaManager::GetPersistentHostQuota(const std::string& host, | 1095 void QuotaManager::GetPersistentHostQuota(const std::string& host, |
1100 HostQuotaCallback* callback_ptr) { | 1096 const HostQuotaCallback& callback) { |
1101 scoped_ptr<HostQuotaCallback> callback(callback_ptr); | |
1102 LazyInitialize(); | 1097 LazyInitialize(); |
1103 if (host.empty()) { | 1098 if (host.empty()) { |
1104 // This could happen if we are called on file:///. | 1099 // This could happen if we are called on file:///. |
1105 // TODO(kinuko) We may want to respect --allow-file-access-from-files | 1100 // TODO(kinuko) We may want to respect --allow-file-access-from-files |
1106 // command line switch. | 1101 // command line switch. |
1107 callback->Run(kQuotaStatusOk, host, kStorageTypePersistent, 0); | 1102 callback.Run(kQuotaStatusOk, host, kStorageTypePersistent, 0); |
1108 return; | 1103 return; |
1109 } | 1104 } |
1110 scoped_refptr<GetPersistentHostQuotaTask> task( | 1105 scoped_refptr<GetPersistentHostQuotaTask> task( |
1111 new GetPersistentHostQuotaTask(this, host, callback.release())); | 1106 new GetPersistentHostQuotaTask(this, host, callback)); |
1112 task->Start(); | 1107 task->Start(); |
1113 } | 1108 } |
1114 | 1109 |
1115 void QuotaManager::SetPersistentHostQuota(const std::string& host, | 1110 void QuotaManager::SetPersistentHostQuota(const std::string& host, |
1116 int64 new_quota, | 1111 int64 new_quota, |
1117 HostQuotaCallback* callback_ptr) { | 1112 const HostQuotaCallback& callback) { |
1118 scoped_ptr<HostQuotaCallback> callback(callback_ptr); | |
1119 LazyInitialize(); | 1113 LazyInitialize(); |
1120 if (host.empty()) { | 1114 if (host.empty()) { |
1121 // This could happen if we are called on file:///. | 1115 // This could happen if we are called on file:///. |
1122 callback->Run(kQuotaErrorNotSupported, host, kStorageTypePersistent, 0); | 1116 callback.Run(kQuotaErrorNotSupported, host, kStorageTypePersistent, 0); |
1123 return; | 1117 return; |
1124 } | 1118 } |
1125 if (new_quota < 0) { | 1119 if (new_quota < 0) { |
1126 callback->Run(kQuotaErrorInvalidModification, | 1120 callback.Run(kQuotaErrorInvalidModification, |
1127 host, kStorageTypePersistent, -1); | 1121 host, kStorageTypePersistent, -1); |
1128 return; | 1122 return; |
1129 } | 1123 } |
1130 | 1124 |
1131 if (!db_disabled_) { | 1125 if (!db_disabled_) { |
1132 scoped_refptr<UpdatePersistentHostQuotaTask> task( | 1126 scoped_refptr<UpdatePersistentHostQuotaTask> task( |
1133 new UpdatePersistentHostQuotaTask( | 1127 new UpdatePersistentHostQuotaTask( |
1134 this, host, new_quota, callback.release())); | 1128 this, host, new_quota, callback)); |
1135 task->Start(); | 1129 task->Start(); |
1136 } else { | 1130 } else { |
1137 callback->Run(kQuotaErrorInvalidAccess, | 1131 callback.Run(kQuotaErrorInvalidAccess, |
1138 host, kStorageTypePersistent, -1); | 1132 host, kStorageTypePersistent, -1); |
1139 } | 1133 } |
1140 } | 1134 } |
1141 | 1135 |
1142 void QuotaManager::GetGlobalUsage( | 1136 void QuotaManager::GetGlobalUsage(StorageType type, |
1143 StorageType type, | 1137 const GlobalUsageCallback& callback) { |
1144 GlobalUsageCallback* callback) { | |
1145 LazyInitialize(); | 1138 LazyInitialize(); |
1146 GetUsageTracker(type)->GetGlobalUsage(callback); | 1139 GetUsageTracker(type)->GetGlobalUsage(callback); |
1147 } | 1140 } |
1148 | 1141 |
1149 void QuotaManager::GetHostUsage(const std::string& host, StorageType type, | 1142 void QuotaManager::GetHostUsage(const std::string& host, |
1150 HostUsageCallback* callback) { | 1143 StorageType type, |
| 1144 const HostUsageCallback& callback) { |
1151 LazyInitialize(); | 1145 LazyInitialize(); |
1152 GetUsageTracker(type)->GetHostUsage(host, callback); | 1146 GetUsageTracker(type)->GetHostUsage(host, callback); |
1153 } | 1147 } |
1154 | 1148 |
1155 void QuotaManager::GetStatistics( | 1149 void QuotaManager::GetStatistics( |
1156 std::map<std::string, std::string>* statistics) { | 1150 std::map<std::string, std::string>* statistics) { |
1157 DCHECK(statistics); | 1151 DCHECK(statistics); |
1158 if (temporary_storage_evictor_.get()) { | 1152 if (temporary_storage_evictor_.get()) { |
1159 std::map<std::string, int64> stats; | 1153 std::map<std::string, int64> stats; |
1160 temporary_storage_evictor_->GetStatistics(&stats); | 1154 temporary_storage_evictor_->GetStatistics(&stats); |
1161 for (std::map<std::string, int64>::iterator p = stats.begin(); | 1155 for (std::map<std::string, int64>::iterator p = stats.begin(); |
1162 p != stats.end(); | 1156 p != stats.end(); |
1163 ++p) | 1157 ++p) |
1164 (*statistics)[p->first] = base::Int64ToString(p->second); | 1158 (*statistics)[p->first] = base::Int64ToString(p->second); |
1165 } | 1159 } |
1166 } | 1160 } |
1167 | 1161 |
1168 void QuotaManager::GetOriginsModifiedSince( | 1162 void QuotaManager::GetOriginsModifiedSince(StorageType type, |
1169 StorageType type, | 1163 base::Time modified_since, |
1170 base::Time modified_since, | 1164 const GetOriginsCallback& callback) { |
1171 GetOriginsCallback* callback) { | |
1172 LazyInitialize(); | 1165 LazyInitialize(); |
1173 make_scoped_refptr(new GetModifiedSinceTask( | 1166 make_scoped_refptr(new GetModifiedSinceTask( |
1174 this, type, modified_since, callback))->Start(); | 1167 this, type, modified_since, callback))->Start(); |
1175 } | 1168 } |
1176 | 1169 |
1177 void QuotaManager::LazyInitialize() { | 1170 void QuotaManager::LazyInitialize() { |
1178 DCHECK(io_thread_->BelongsToCurrentThread()); | 1171 DCHECK(io_thread_->BelongsToCurrentThread()); |
1179 if (database_.get()) { | 1172 if (database_.get()) { |
1180 // Initialization seems to be done already. | 1173 // Initialization seems to be done already. |
1181 return; | 1174 return; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1221 | 1214 |
1222 void QuotaManager::NotifyOriginNoLongerInUse(const GURL& origin) { | 1215 void QuotaManager::NotifyOriginNoLongerInUse(const GURL& origin) { |
1223 DCHECK(io_thread_->BelongsToCurrentThread()); | 1216 DCHECK(io_thread_->BelongsToCurrentThread()); |
1224 DCHECK(IsOriginInUse(origin)); | 1217 DCHECK(IsOriginInUse(origin)); |
1225 int& count = origins_in_use_[origin]; | 1218 int& count = origins_in_use_[origin]; |
1226 if (--count == 0) | 1219 if (--count == 0) |
1227 origins_in_use_.erase(origin); | 1220 origins_in_use_.erase(origin); |
1228 } | 1221 } |
1229 | 1222 |
1230 void QuotaManager::DeleteOriginData( | 1223 void QuotaManager::DeleteOriginData( |
1231 const GURL& origin, StorageType type, StatusCallback* callback) { | 1224 const GURL& origin, StorageType type, const StatusCallback& callback) { |
1232 LazyInitialize(); | 1225 LazyInitialize(); |
1233 | 1226 |
1234 if (origin.is_empty() || clients_.empty()) { | 1227 if (origin.is_empty() || clients_.empty()) { |
1235 callback->Run(kQuotaStatusOk); | 1228 callback.Run(kQuotaStatusOk); |
1236 delete callback; | |
1237 return; | 1229 return; |
1238 } | 1230 } |
1239 | 1231 |
1240 OriginDataDeleter* deleter = | 1232 OriginDataDeleter* deleter = |
1241 new OriginDataDeleter(this, origin, type, callback); | 1233 new OriginDataDeleter(this, origin, type, callback); |
1242 deleter->Start(); | 1234 deleter->Start(); |
1243 } | 1235 } |
1244 | 1236 |
1245 bool QuotaManager::ResetUsageTracker(StorageType type) { | 1237 bool QuotaManager::ResetUsageTracker(StorageType type) { |
1246 switch (type) { | 1238 switch (type) { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1356 // is already initialized iff the requested type is temporary. | 1348 // is already initialized iff the requested type is temporary. |
1357 // (The first dispatcher task for temporary will be kicked in | 1349 // (The first dispatcher task for temporary will be kicked in |
1358 // DidRunInitializeTask if temporary_quota_initialized_ is false here.) | 1350 // DidRunInitializeTask if temporary_quota_initialized_ is false here.) |
1359 if (found->second->AddCallback(callback) && | 1351 if (found->second->AddCallback(callback) && |
1360 (requested_type != kStorageTypeTemporary || | 1352 (requested_type != kStorageTypeTemporary || |
1361 temporary_quota_initialized_)) { | 1353 temporary_quota_initialized_)) { |
1362 found->second->Start(); | 1354 found->second->Start(); |
1363 } | 1355 } |
1364 } | 1356 } |
1365 | 1357 |
1366 void QuotaManager::DumpQuotaTable(DumpQuotaTableCallback* callback) { | 1358 void QuotaManager::DumpQuotaTable(const DumpQuotaTableCallback& callback) { |
1367 make_scoped_refptr(new DumpQuotaTableTask(this, callback))->Start(); | 1359 make_scoped_refptr(new DumpQuotaTableTask(this, callback))->Start(); |
1368 } | 1360 } |
1369 | 1361 |
1370 void QuotaManager::DumpOriginInfoTable( | 1362 void QuotaManager::DumpOriginInfoTable( |
1371 DumpOriginInfoTableCallback* callback) { | 1363 const DumpOriginInfoTableCallback& callback) { |
1372 make_scoped_refptr(new DumpOriginInfoTableTask(this, callback))->Start(); | 1364 make_scoped_refptr(new DumpOriginInfoTableTask(this, callback))->Start(); |
1373 } | 1365 } |
1374 | 1366 |
1375 | 1367 |
1376 void QuotaManager::DeleteOriginFromDatabase( | 1368 void QuotaManager::DeleteOriginFromDatabase( |
1377 const GURL& origin, StorageType type) { | 1369 const GURL& origin, StorageType type) { |
1378 LazyInitialize(); | 1370 LazyInitialize(); |
1379 if (db_disabled_) | 1371 if (db_disabled_) |
1380 return; | 1372 return; |
1381 scoped_refptr<DeleteOriginInfo> task = | 1373 scoped_refptr<DeleteOriginInfo> task = |
(...skipping 13 matching lines...) Expand all Loading... |
1395 lru_origin_callback_.Reset(); | 1387 lru_origin_callback_.Reset(); |
1396 return; | 1388 return; |
1397 } | 1389 } |
1398 scoped_refptr<GetLRUOriginTask> task(new GetLRUOriginTask( | 1390 scoped_refptr<GetLRUOriginTask> task(new GetLRUOriginTask( |
1399 this, type, origins_in_use_, origins_in_error_, | 1391 this, type, origins_in_use_, origins_in_error_, |
1400 base::Bind(&QuotaManager::DidGetDatabaseLRUOrigin, | 1392 base::Bind(&QuotaManager::DidGetDatabaseLRUOrigin, |
1401 weak_factory_.GetWeakPtr()))); | 1393 weak_factory_.GetWeakPtr()))); |
1402 task->Start(); | 1394 task->Start(); |
1403 } | 1395 } |
1404 | 1396 |
1405 void QuotaManager::DidOriginDataEvicted( | 1397 void QuotaManager::DidOriginDataEvicted(QuotaStatusCode status) { |
1406 QuotaStatusCode status) { | |
1407 DCHECK(io_thread_->BelongsToCurrentThread()); | 1398 DCHECK(io_thread_->BelongsToCurrentThread()); |
1408 | 1399 |
1409 // We only try evict origins that are not in use, so basically | 1400 // We only try evict origins that are not in use, so basically |
1410 // deletion attempt for eviction should not fail. Let's record | 1401 // deletion attempt for eviction should not fail. Let's record |
1411 // the origin if we get error and exclude it from future eviction | 1402 // the origin if we get error and exclude it from future eviction |
1412 // if the error happens consistently (> kThresholdOfErrorsToBeBlacklisted). | 1403 // if the error happens consistently (> kThresholdOfErrorsToBeBlacklisted). |
1413 if (status != kQuotaStatusOk) | 1404 if (status != kQuotaStatusOk) |
1414 origins_in_error_[eviction_context_.evicted_origin]++; | 1405 origins_in_error_[eviction_context_.evicted_origin]++; |
1415 | 1406 |
1416 eviction_context_.evict_origin_data_callback->Run(status); | 1407 eviction_context_.evict_origin_data_callback.Run(status); |
1417 eviction_context_.evict_origin_data_callback.reset(); | 1408 eviction_context_.evict_origin_data_callback.Reset(); |
1418 } | 1409 } |
1419 | 1410 |
1420 void QuotaManager::EvictOriginData( | 1411 void QuotaManager::EvictOriginData( |
1421 const GURL& origin, | 1412 const GURL& origin, |
1422 StorageType type, | 1413 StorageType type, |
1423 EvictOriginDataCallback* callback) { | 1414 const EvictOriginDataCallback& callback) { |
1424 DCHECK(io_thread_->BelongsToCurrentThread()); | 1415 DCHECK(io_thread_->BelongsToCurrentThread()); |
1425 DCHECK_EQ(type, kStorageTypeTemporary); | 1416 DCHECK_EQ(type, kStorageTypeTemporary); |
1426 | 1417 |
1427 eviction_context_.evicted_origin = origin; | 1418 eviction_context_.evicted_origin = origin; |
1428 eviction_context_.evicted_type = type; | 1419 eviction_context_.evicted_type = type; |
1429 eviction_context_.evict_origin_data_callback.reset(callback); | 1420 eviction_context_.evict_origin_data_callback = callback; |
1430 | 1421 |
1431 DeleteOriginData(origin, type, callback_factory_.NewCallback( | 1422 DeleteOriginData(origin, type, |
1432 &QuotaManager::DidOriginDataEvicted)); | 1423 base::Bind(&QuotaManager::DidOriginDataEvicted, |
| 1424 weak_factory_.GetWeakPtr())); |
1433 } | 1425 } |
1434 | 1426 |
1435 void QuotaManager::GetUsageAndQuotaForEviction( | 1427 void QuotaManager::GetUsageAndQuotaForEviction( |
1436 const GetUsageAndQuotaForEvictionCallback& callback) { | 1428 const GetUsageAndQuotaForEvictionCallback& callback) { |
1437 DCHECK(io_thread_->BelongsToCurrentThread()); | 1429 DCHECK(io_thread_->BelongsToCurrentThread()); |
1438 GetUsageAndQuotaInternal( | 1430 GetUsageAndQuotaInternal( |
1439 GURL(), kStorageTypeTemporary, true /* global */, callback); | 1431 GURL(), kStorageTypeTemporary, true /* global */, callback); |
1440 } | 1432 } |
1441 | 1433 |
1442 void QuotaManager::StartEviction() { | 1434 void QuotaManager::StartEviction() { |
1443 DCHECK(!temporary_storage_evictor_.get()); | 1435 DCHECK(!temporary_storage_evictor_.get()); |
1444 temporary_storage_evictor_.reset(new QuotaTemporaryStorageEvictor( | 1436 temporary_storage_evictor_.reset(new QuotaTemporaryStorageEvictor( |
1445 this, kEvictionIntervalInMilliSeconds)); | 1437 this, kEvictionIntervalInMilliSeconds)); |
1446 if (desired_available_space_ >= 0) | 1438 if (desired_available_space_ >= 0) |
1447 temporary_storage_evictor_->set_min_available_disk_space_to_start_eviction( | 1439 temporary_storage_evictor_->set_min_available_disk_space_to_start_eviction( |
1448 desired_available_space_); | 1440 desired_available_space_); |
1449 temporary_storage_evictor_->Start(); | 1441 temporary_storage_evictor_->Start(); |
1450 } | 1442 } |
1451 | 1443 |
1452 void QuotaManager::ReportHistogram() { | 1444 void QuotaManager::ReportHistogram() { |
1453 GetGlobalUsage(kStorageTypeTemporary, | 1445 GetGlobalUsage(kStorageTypeTemporary, |
1454 callback_factory_.NewCallback( | 1446 base::Bind( |
1455 &QuotaManager::DidGetTemporaryGlobalUsageForHistogram)); | 1447 &QuotaManager::DidGetTemporaryGlobalUsageForHistogram, |
| 1448 weak_factory_.GetWeakPtr())); |
1456 GetGlobalUsage(kStorageTypePersistent, | 1449 GetGlobalUsage(kStorageTypePersistent, |
1457 callback_factory_.NewCallback( | 1450 base::Bind( |
1458 &QuotaManager::DidGetPersistentGlobalUsageForHistogram)); | 1451 &QuotaManager::DidGetPersistentGlobalUsageForHistogram, |
| 1452 weak_factory_.GetWeakPtr())); |
1459 } | 1453 } |
1460 | 1454 |
1461 void QuotaManager::DidGetTemporaryGlobalUsageForHistogram( | 1455 void QuotaManager::DidGetTemporaryGlobalUsageForHistogram( |
1462 StorageType type, | 1456 StorageType type, |
1463 int64 usage, | 1457 int64 usage, |
1464 int64 unlimited_usage) { | 1458 int64 unlimited_usage) { |
1465 UMA_HISTOGRAM_MBYTES("Quota.GlobalUsageOfTemporaryStorage", usage); | 1459 UMA_HISTOGRAM_MBYTES("Quota.GlobalUsageOfTemporaryStorage", usage); |
1466 | 1460 |
1467 std::set<GURL> origins; | 1461 std::set<GURL> origins; |
1468 GetCachedOrigins(type, &origins); | 1462 GetCachedOrigins(type, &origins); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1516 // temporary_quota_initialized_ to be initialized (if there're any). | 1510 // temporary_quota_initialized_ to be initialized (if there're any). |
1517 for (UsageAndQuotaDispatcherTaskMap::iterator iter = | 1511 for (UsageAndQuotaDispatcherTaskMap::iterator iter = |
1518 usage_and_quota_dispatchers_.begin(); | 1512 usage_and_quota_dispatchers_.begin(); |
1519 iter != usage_and_quota_dispatchers_.end(); ++iter) { | 1513 iter != usage_and_quota_dispatchers_.end(); ++iter) { |
1520 if (iter->second->IsStartable()) | 1514 if (iter->second->IsStartable()) |
1521 iter->second->Start(); | 1515 iter->second->Start(); |
1522 } | 1516 } |
1523 | 1517 |
1524 // Kick the first GetTemporaryGlobalQuota. This internally fetches (and | 1518 // Kick the first GetTemporaryGlobalQuota. This internally fetches (and |
1525 // caches) the usage of all origins and checks the available disk space. | 1519 // caches) the usage of all origins and checks the available disk space. |
1526 GetTemporaryGlobalQuota(callback_factory_.NewCallback( | 1520 GetTemporaryGlobalQuota( |
1527 &QuotaManager::DidGetInitialTemporaryGlobalQuota)); | 1521 base::Bind(&QuotaManager::DidGetInitialTemporaryGlobalQuota, |
| 1522 weak_factory_.GetWeakPtr())); |
1528 } | 1523 } |
1529 | 1524 |
1530 void QuotaManager::DidGetInitialTemporaryGlobalQuota( | 1525 void QuotaManager::DidGetInitialTemporaryGlobalQuota( |
1531 QuotaStatusCode status, StorageType type, int64 quota_unused) { | 1526 QuotaStatusCode status, StorageType type, int64 quota_unused) { |
1532 DCHECK_EQ(type, kStorageTypeTemporary); | 1527 DCHECK_EQ(type, kStorageTypeTemporary); |
1533 | 1528 |
1534 if (eviction_disabled_) | 1529 if (eviction_disabled_) |
1535 return; | 1530 return; |
1536 | 1531 |
1537 // This will call the StartEviction() when initial origin registration | 1532 // This will call the StartEviction() when initial origin registration |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1632 | 1627 |
1633 QuotaManagerProxy::QuotaManagerProxy( | 1628 QuotaManagerProxy::QuotaManagerProxy( |
1634 QuotaManager* manager, base::MessageLoopProxy* io_thread) | 1629 QuotaManager* manager, base::MessageLoopProxy* io_thread) |
1635 : manager_(manager), io_thread_(io_thread) { | 1630 : manager_(manager), io_thread_(io_thread) { |
1636 } | 1631 } |
1637 | 1632 |
1638 QuotaManagerProxy::~QuotaManagerProxy() { | 1633 QuotaManagerProxy::~QuotaManagerProxy() { |
1639 } | 1634 } |
1640 | 1635 |
1641 } // namespace quota | 1636 } // namespace quota |
OLD | NEW |