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 #ifndef WEBKIT_QUOTA_QUOTA_TASK_H_ | 5 #ifndef WEBKIT_QUOTA_QUOTA_TASK_H_ |
6 #define WEBKIT_QUOTA_QUOTA_TASK_H_ | 6 #define WEBKIT_QUOTA_QUOTA_TASK_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 } | 71 } |
72 | 72 |
73 private: | 73 private: |
74 friend class base::RefCountedThreadSafe<QuotaThreadTask>; | 74 friend class base::RefCountedThreadSafe<QuotaThreadTask>; |
75 friend class QuotaTaskObserver; | 75 friend class QuotaTaskObserver; |
76 void CallRunOnTargetThread(); | 76 void CallRunOnTargetThread(); |
77 | 77 |
78 scoped_refptr<base::MessageLoopProxy> target_message_loop_; | 78 scoped_refptr<base::MessageLoopProxy> target_message_loop_; |
79 }; | 79 }; |
80 | 80 |
| 81 // For delayed tasks that post tasks to the other thread. |
| 82 class QuotaDelayedThreadTask : public QuotaThreadTask { |
| 83 public: |
| 84 QuotaDelayedThreadTask( |
| 85 QuotaTaskObserver* observer, |
| 86 scoped_refptr<base::MessageLoopProxy> target_message_loop |
| 87 int64 delay_ms); |
| 88 |
| 89 protected: |
| 90 virtual void Run() OVERRIDE; |
| 91 |
| 92 private: |
| 93 int64 delay_ms_; |
| 94 }; |
| 95 |
81 class QuotaTaskObserver { | 96 class QuotaTaskObserver { |
82 public: | 97 public: |
83 virtual ~QuotaTaskObserver(); | 98 virtual ~QuotaTaskObserver(); |
84 | 99 |
85 protected: | 100 protected: |
86 friend class QuotaTask; | 101 friend class QuotaTask; |
87 friend class QuotaThreadTask; | 102 friend class QuotaThreadTask; |
88 | 103 |
89 QuotaTaskObserver(); | 104 QuotaTaskObserver(); |
90 void RegisterTask(QuotaTask* task); | 105 void RegisterTask(QuotaTask* task); |
91 void UnregisterTask(QuotaTask* task); | 106 void UnregisterTask(QuotaTask* task); |
92 | 107 |
93 typedef std::set<QuotaTask*> TaskSet; | 108 typedef std::set<QuotaTask*> TaskSet; |
94 TaskSet running_quota_tasks_; | 109 TaskSet running_quota_tasks_; |
95 }; | 110 }; |
96 | 111 |
97 } | 112 } |
98 | 113 |
99 #endif // WEBKIT_QUOTA_QUOTA_TASK_H_ | 114 #endif // WEBKIT_QUOTA_QUOTA_TASK_H_ |
OLD | NEW |