Chromium Code Reviews| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 59 // For tasks that post tasks to the other thread. | 59 // For tasks that post tasks to the other thread. |
| 60 class QuotaThreadTask : public QuotaTask, | 60 class QuotaThreadTask : public QuotaTask, |
| 61 public base::RefCountedThreadSafe<QuotaThreadTask> { | 61 public base::RefCountedThreadSafe<QuotaThreadTask> { |
| 62 public: | 62 public: |
| 63 QuotaThreadTask(QuotaTaskObserver* observer, | 63 QuotaThreadTask(QuotaTaskObserver* observer, |
| 64 scoped_refptr<base::MessageLoopProxy> target_message_loop); | 64 scoped_refptr<base::MessageLoopProxy> target_message_loop); |
| 65 | 65 |
| 66 protected: | 66 protected: |
| 67 virtual ~QuotaThreadTask(); | 67 virtual ~QuotaThreadTask(); |
| 68 | 68 |
| 69 // Called on the target message loop. | 69 // One of the following should be overriden. |
|
tzik
2011/05/23 05:30:59
Could you add some more comment for RunOnTargetThr
michaeln
2011/05/23 21:56:52
Done.
// One of the following Run methods shoul
| |
| 70 virtual void RunOnTargetThread() = 0; | 70 virtual void RunOnTargetThread(); |
| 71 virtual bool RunOnTargetThreadAsync(); | |
| 71 | 72 |
| 72 virtual void Run() OVERRIDE; | 73 virtual void Run() OVERRIDE; |
| 73 scoped_refptr<base::MessageLoopProxy> target_message_loop() const { | 74 scoped_refptr<base::MessageLoopProxy> target_message_loop() const { |
| 74 return target_message_loop_; | 75 return target_message_loop_; |
| 75 } | 76 } |
| 76 | 77 |
| 77 private: | 78 private: |
| 78 friend class base::RefCountedThreadSafe<QuotaThreadTask>; | 79 friend class base::RefCountedThreadSafe<QuotaThreadTask>; |
| 79 friend class QuotaTaskObserver; | 80 friend class QuotaTaskObserver; |
| 80 void CallRunOnTargetThread(); | 81 void CallRunOnTargetThread(); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 93 QuotaTaskObserver(); | 94 QuotaTaskObserver(); |
| 94 void RegisterTask(QuotaTask* task); | 95 void RegisterTask(QuotaTask* task); |
| 95 void UnregisterTask(QuotaTask* task); | 96 void UnregisterTask(QuotaTask* task); |
| 96 | 97 |
| 97 typedef std::set<QuotaTask*> TaskSet; | 98 typedef std::set<QuotaTask*> TaskSet; |
| 98 TaskSet running_quota_tasks_; | 99 TaskSet running_quota_tasks_; |
| 99 }; | 100 }; |
| 100 } | 101 } |
| 101 | 102 |
| 102 #endif // WEBKIT_QUOTA_QUOTA_TASK_H_ | 103 #endif // WEBKIT_QUOTA_QUOTA_TASK_H_ |
| OLD | NEW |