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

Side by Side Diff: storage/browser/quota/quota_manager.h

Issue 1221523003: Add a SiteEngagementEvictionPolicy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@get_total_engagement_points
Patch Set: Created 5 years, 5 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef STORAGE_BROWSER_QUOTA_QUOTA_MANAGER_H_ 5 #ifndef STORAGE_BROWSER_QUOTA_QUOTA_MANAGER_H_
6 #define STORAGE_BROWSER_QUOTA_QUOTA_MANAGER_H_ 6 #define STORAGE_BROWSER_QUOTA_QUOTA_MANAGER_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <list> 9 #include <list>
10 #include <map> 10 #include <map>
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 int64 quota; 62 int64 quota;
63 int64 available_disk_space; 63 int64 available_disk_space;
64 64
65 UsageAndQuota(); 65 UsageAndQuota();
66 UsageAndQuota(int64 usage, 66 UsageAndQuota(int64 usage,
67 int64 global_limited_usage, 67 int64 global_limited_usage,
68 int64 quota, 68 int64 quota,
69 int64 available_disk_space); 69 int64 available_disk_space);
70 }; 70 };
71 71
72 class STORAGE_EXPORT TemporaryStorageEvictionPolicy {
raymes 2015/07/08 04:43:29 Perhaps make a note that this isn't hooked up in t
calamity 2015/07/10 05:05:05 Done.
73 public:
74 virtual void GetEvictionOrigin(const std::map<GURL, int64>& usage_map,
raymes 2015/07/08 04:43:29 We should document this. I think it's good to note
calamity 2015/07/10 05:05:05 Done.
75 int64 global_quota,
76 const GetEvictionOriginCallback& callback) = 0;
77
78 protected:
79 ~TemporaryStorageEvictionPolicy() {}
80 };
81
72 // An interface called by QuotaTemporaryStorageEvictor. 82 // An interface called by QuotaTemporaryStorageEvictor.
73 class STORAGE_EXPORT QuotaEvictionHandler { 83 class STORAGE_EXPORT QuotaEvictionHandler {
74 public: 84 public:
75 typedef base::Callback<void(const GURL&)> GetLRUOriginCallback;
76 typedef StatusCallback EvictOriginDataCallback; 85 typedef StatusCallback EvictOriginDataCallback;
77 typedef base::Callback<void(QuotaStatusCode status, 86 typedef base::Callback<void(QuotaStatusCode status,
78 const UsageAndQuota& usage_and_quota)> 87 const UsageAndQuota& usage_and_quota)>
79 UsageAndQuotaCallback; 88 UsageAndQuotaCallback;
80 89
81 // Returns the least recently used origin. It might return empty 90 // Returns the least recently used origin. It might return empty
82 // GURL when there are no evictable origins. 91 // GURL when there are no evictable origins.
83 virtual void GetLRUOrigin( 92 virtual void GetEvictionOrigin(StorageType type,
84 StorageType type, 93 const GetEvictionOriginCallback& callback) = 0;
85 const GetLRUOriginCallback& callback) = 0;
86 94
87 virtual void EvictOriginData( 95 virtual void EvictOriginData(
88 const GURL& origin, 96 const GURL& origin,
89 StorageType type, 97 StorageType type,
90 const EvictOriginDataCallback& callback) = 0; 98 const EvictOriginDataCallback& callback) = 0;
91 99
92 virtual void GetUsageAndQuotaForEviction( 100 virtual void GetUsageAndQuotaForEviction(
93 const UsageAndQuotaCallback& callback) = 0; 101 const UsageAndQuotaCallback& callback) = 0;
94 102
95 protected: 103 protected:
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 363
356 void DidOriginDataEvicted(QuotaStatusCode status); 364 void DidOriginDataEvicted(QuotaStatusCode status);
357 365
358 void ReportHistogram(); 366 void ReportHistogram();
359 void DidGetTemporaryGlobalUsageForHistogram(int64 usage, 367 void DidGetTemporaryGlobalUsageForHistogram(int64 usage,
360 int64 unlimited_usage); 368 int64 unlimited_usage);
361 void DidGetPersistentGlobalUsageForHistogram(int64 usage, 369 void DidGetPersistentGlobalUsageForHistogram(int64 usage,
362 int64 unlimited_usage); 370 int64 unlimited_usage);
363 371
364 // QuotaEvictionHandler. 372 // QuotaEvictionHandler.
365 void GetLRUOrigin(StorageType type, 373 void GetEvictionOrigin(StorageType type,
366 const GetLRUOriginCallback& callback) override; 374 const GetEvictionOriginCallback& callback) override;
367 void EvictOriginData(const GURL& origin, 375 void EvictOriginData(const GURL& origin,
368 StorageType type, 376 StorageType type,
369 const EvictOriginDataCallback& callback) override; 377 const EvictOriginDataCallback& callback) override;
370 void GetUsageAndQuotaForEviction( 378 void GetUsageAndQuotaForEviction(
371 const UsageAndQuotaCallback& callback) override; 379 const UsageAndQuotaCallback& callback) override;
372 380
381 void GetLRUOrigin(StorageType type,
382 const GetEvictionOriginCallback& callback);
383
373 void DidSetTemporaryGlobalOverrideQuota(const QuotaCallback& callback, 384 void DidSetTemporaryGlobalOverrideQuota(const QuotaCallback& callback,
374 const int64* new_quota, 385 const int64* new_quota,
375 bool success); 386 bool success);
376 void DidGetPersistentHostQuota(const std::string& host, 387 void DidGetPersistentHostQuota(const std::string& host,
377 const int64* quota, 388 const int64* quota,
378 bool success); 389 bool success);
379 void DidSetPersistentHostQuota(const std::string& host, 390 void DidSetPersistentHostQuota(const std::string& host,
380 const QuotaCallback& callback, 391 const QuotaCallback& callback,
381 const int64* new_quota, 392 const int64* new_quota,
382 bool success); 393 bool success);
(...skipping 18 matching lines...) Expand all
401 const bool is_incognito_; 412 const bool is_incognito_;
402 const base::FilePath profile_path_; 413 const base::FilePath profile_path_;
403 414
404 scoped_refptr<QuotaManagerProxy> proxy_; 415 scoped_refptr<QuotaManagerProxy> proxy_;
405 bool db_disabled_; 416 bool db_disabled_;
406 bool eviction_disabled_; 417 bool eviction_disabled_;
407 scoped_refptr<base::SingleThreadTaskRunner> io_thread_; 418 scoped_refptr<base::SingleThreadTaskRunner> io_thread_;
408 scoped_refptr<base::SequencedTaskRunner> db_thread_; 419 scoped_refptr<base::SequencedTaskRunner> db_thread_;
409 mutable scoped_ptr<QuotaDatabase> database_; 420 mutable scoped_ptr<QuotaDatabase> database_;
410 421
411 GetLRUOriginCallback lru_origin_callback_; 422 GetEvictionOriginCallback lru_origin_callback_;
412 std::set<GURL> access_notified_origins_; 423 std::set<GURL> access_notified_origins_;
413 424
414 QuotaClientList clients_; 425 QuotaClientList clients_;
415 426
416 scoped_ptr<UsageTracker> temporary_usage_tracker_; 427 scoped_ptr<UsageTracker> temporary_usage_tracker_;
417 scoped_ptr<UsageTracker> persistent_usage_tracker_; 428 scoped_ptr<UsageTracker> persistent_usage_tracker_;
418 scoped_ptr<UsageTracker> syncable_usage_tracker_; 429 scoped_ptr<UsageTracker> syncable_usage_tracker_;
419 // TODO(michaeln): Need a way to clear the cache, drop and 430 // TODO(michaeln): Need a way to clear the cache, drop and
420 // reinstantiate the trackers when they're not handling requests. 431 // reinstantiate the trackers when they're not handling requests.
421 432
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 465
455 struct QuotaManagerDeleter { 466 struct QuotaManagerDeleter {
456 static void Destruct(const QuotaManager* manager) { 467 static void Destruct(const QuotaManager* manager) {
457 manager->DeleteOnCorrectThread(); 468 manager->DeleteOnCorrectThread();
458 } 469 }
459 }; 470 };
460 471
461 } // namespace storage 472 } // namespace storage
462 473
463 #endif // STORAGE_BROWSER_QUOTA_QUOTA_MANAGER_H_ 474 #endif // STORAGE_BROWSER_QUOTA_QUOTA_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698