Index: webkit/quota/quota_temporary_storage_evictor.h |
diff --git a/webkit/quota/quota_temporary_storage_evictor.h b/webkit/quota/quota_temporary_storage_evictor.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c94574e98822761c63f7ef1e297c1d7e821a11d2 |
--- /dev/null |
+++ b/webkit/quota/quota_temporary_storage_evictor.h |
@@ -0,0 +1,64 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef WEBKIT_QUOTA_QUOTA_TEMPORARY_STORAGE_EVICTOR_H_ |
+#define WEBKIT_QUOTA_QUOTA_TEMPORARY_STORAGE_EVICTOR_H_ |
+#pragma once |
+ |
+#include "base/message_loop_proxy.h" |
+#include "base/memory/ref_counted.h" |
+#include "base/memory/scoped_callback_factory.h" |
+#include "webkit/quota/quota_database.h" |
+#include "webkit/quota/quota_manager.h" |
+#include "webkit/quota/quota_task.h" |
+#include "webkit/quota/quota_types.h" |
+ |
+class GURL; |
+ |
+namespace quota { |
+ |
+class QuotaTemporaryStorageEvictor |
+ : public base::RefCountedThreadSafe<QuotaTemporaryStorageEvictor> { |
+ public: |
+ // 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.
|
+ QuotaTemporaryStorageEvictor( |
+ QuotaManager* quota_manager, |
+ QuotaDatabase* quota_database, |
+ int64 delay_ms, |
+ scoped_refptr<base::MessageLoopProxy> io_message_loop, |
+ scoped_refptr<base::MessageLoopProxy> db_message_loop); |
+ virtual ~QuotaTemporaryStorageEvictor(); |
+ |
+ // It can be called from any thread. |
+ // It posts a task to the db_thread internally. |
+ void Start(); |
+ |
+ // It must be called on the io_thread. |
+ void OnQuotaManagerDestroyedOnIOThread(); |
+ |
+ private: |
+ void Evict(); |
+ |
+ // It must be called-back from the io_thread. |
+ void OnDeletionCompletedOnIOThread(QuotaStatusCode status); |
+ |
+ // It must be called on the io_thread. |
+ void CallDeleteOriginOnIOThread(const GURL& origin); |
+ |
+ // This pointer must be accessed in the io_thread. |
+ QuotaManager* quota_manager_; |
+ |
+ QuotaDatabase* quota_database_; |
+ int delay_ms_; |
+ scoped_refptr<base::MessageLoopProxy> io_message_loop_; |
+ scoped_refptr<base::MessageLoopProxy> db_message_loop_; |
+ |
+ base::ScopedCallbackFactory<QuotaTemporaryStorageEvictor> callback_factory_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(QuotaTemporaryStorageEvictor); |
+}; |
+ |
+} // namespace quota |
+ |
+#endif // WEBKIT_QUOTA_QUOTA_TEMPORARY_STORAGE_EVICTOR_H_ |