Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef WEBKIT_QUOTA_QUOTA_TEMPORARY_STORAGE_EVICTOR_H_ | |
| 6 #define WEBKIT_QUOTA_QUOTA_TEMPORARY_STORAGE_EVICTOR_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "base/message_loop_proxy.h" | |
| 10 #include "base/memory/ref_counted.h" | |
| 11 #include "base/memory/scoped_callback_factory.h" | |
| 12 #include "webkit/quota/quota_database.h" | |
| 13 #include "webkit/quota/quota_manager.h" | |
| 14 #include "webkit/quota/quota_task.h" | |
| 15 #include "webkit/quota/quota_types.h" | |
| 16 | |
| 17 class GURL; | |
| 18 | |
| 19 namespace quota { | |
| 20 | |
| 21 class QuotaTemporaryStorageEvictor | |
| 22 : public base::RefCountedThreadSafe<QuotaTemporaryStorageEvictor> { | |
| 23 public: | |
| 24 // Constructed in the io_thread. | |
|
kinuko
2011/05/13 05:49:04
nit: in -> on?
Dai Mikurube (NOT FULLTIME)
2011/05/13 07:52:40
Done.
| |
| 25 QuotaTemporaryStorageEvictor( | |
| 26 QuotaManager* quota_manager, | |
| 27 QuotaDatabase* quota_database, | |
| 28 int64 delay_ms, | |
| 29 scoped_refptr<base::MessageLoopProxy> io_message_loop, | |
| 30 scoped_refptr<base::MessageLoopProxy> db_message_loop); | |
| 31 virtual ~QuotaTemporaryStorageEvictor(); | |
| 32 | |
| 33 // It can be called from any thread. | |
| 34 // It posts a task to the db_thread internally. | |
| 35 void Start(); | |
| 36 | |
| 37 // It must be called on the io_thread. | |
| 38 void OnQuotaManagerDestroyedOnIOThread(); | |
| 39 | |
| 40 private: | |
| 41 void Evict(); | |
| 42 | |
| 43 // It must be called-back from the io_thread. | |
| 44 void OnDeletionCompletedOnIOThread(QuotaStatusCode status); | |
| 45 | |
| 46 // It must be called on the io_thread. | |
| 47 void CallDeleteOriginOnIOThread(const GURL& origin); | |
| 48 | |
| 49 // This pointer must be accessed in the io_thread. | |
| 50 QuotaManager* quota_manager_; | |
| 51 | |
| 52 QuotaDatabase* quota_database_; | |
| 53 int delay_ms_; | |
| 54 scoped_refptr<base::MessageLoopProxy> io_message_loop_; | |
| 55 scoped_refptr<base::MessageLoopProxy> db_message_loop_; | |
| 56 | |
| 57 base::ScopedCallbackFactory<QuotaTemporaryStorageEvictor> callback_factory_; | |
| 58 | |
| 59 DISALLOW_COPY_AND_ASSIGN(QuotaTemporaryStorageEvictor); | |
| 60 }; | |
| 61 | |
| 62 } // namespace quota | |
| 63 | |
| 64 #endif // WEBKIT_QUOTA_QUOTA_TEMPORARY_STORAGE_EVICTOR_H_ | |
| OLD | NEW |