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 #include "webkit/quota/quota_task.h" | 5 #include "webkit/quota/quota_task.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 | 9 |
10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
60 this, &QuotaThreadTask::CallRunOnTargetThread)); | 60 this, &QuotaThreadTask::CallRunOnTargetThread)); |
61 } | 61 } |
62 | 62 |
63 void QuotaThreadTask::CallRunOnTargetThread() { | 63 void QuotaThreadTask::CallRunOnTargetThread() { |
64 DCHECK(target_message_loop_->BelongsToCurrentThread()); | 64 DCHECK(target_message_loop_->BelongsToCurrentThread()); |
65 RunOnTargetThread(); | 65 RunOnTargetThread(); |
66 original_message_loop()->PostTask( | 66 original_message_loop()->PostTask( |
67 FROM_HERE, NewRunnableMethod(this, &QuotaThreadTask::CallCompleted)); | 67 FROM_HERE, NewRunnableMethod(this, &QuotaThreadTask::CallCompleted)); |
68 } | 68 } |
69 | 69 |
70 // QuotaDelayedThreadTask -------------------------------------------------- | |
71 | |
72 QuotaDelayedThreadTask::QuotaDelayedThreadTask( | |
73 QuotaTaskObserver* observer, | |
74 scoped_refptr<base::MessageLoopProxy> target_message_loop | |
75 int64 delay_ms) | |
76 : QuotaThreadTask(observer, target_message_loop), | |
77 delay_ms_(delay_ms) { | |
78 } | |
79 | |
80 void QuotaDelayedThreadTask::Run() { | |
81 target_message_loop_->PostDelayedTask(FROM_HERE, NewRunnableMethod( | |
82 this, &QuotaThreadTask::CallRunOnTargetThread), delay_ms_); | |
kinuko
2011/05/11 07:49:30
On the second thought I guess for Evictor's main j
Dai Mikurube (NOT FULLTIME)
2011/05/11 11:23:50
Changed it and removed QuotaDelayedThreadTask. BT
Dai Mikurube (NOT FULLTIME)
2011/05/11 11:31:31
Ah, failed to remove it. Removed in the patch set
| |
83 } | |
84 | |
70 // QuotaTaskObserver ------------------------------------------------------- | 85 // QuotaTaskObserver ------------------------------------------------------- |
71 | 86 |
72 QuotaTaskObserver::~QuotaTaskObserver() { | 87 QuotaTaskObserver::~QuotaTaskObserver() { |
73 std::for_each(running_quota_tasks_.begin(), | 88 std::for_each(running_quota_tasks_.begin(), |
74 running_quota_tasks_.end(), | 89 running_quota_tasks_.end(), |
75 std::mem_fun(&QuotaTask::Abort)); | 90 std::mem_fun(&QuotaTask::Abort)); |
76 } | 91 } |
77 | 92 |
78 QuotaTaskObserver::QuotaTaskObserver() { | 93 QuotaTaskObserver::QuotaTaskObserver() { |
79 } | 94 } |
80 | 95 |
81 void QuotaTaskObserver::RegisterTask(QuotaTask* task) { | 96 void QuotaTaskObserver::RegisterTask(QuotaTask* task) { |
82 running_quota_tasks_.insert(task); | 97 running_quota_tasks_.insert(task); |
83 } | 98 } |
84 | 99 |
85 void QuotaTaskObserver::UnregisterTask(QuotaTask* task) { | 100 void QuotaTaskObserver::UnregisterTask(QuotaTask* task) { |
86 DCHECK(running_quota_tasks_.find(task) != running_quota_tasks_.end()); | 101 DCHECK(running_quota_tasks_.find(task) != running_quota_tasks_.end()); |
87 running_quota_tasks_.erase(task); | 102 running_quota_tasks_.erase(task); |
88 } | 103 } |
89 | 104 |
90 } // namespace quota | 105 } // namespace quota |
OLD | NEW |