OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/mock_quota_manager.h" | 5 #include "webkit/quota/mock_quota_manager.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/single_thread_task_runner.h" |
13 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
14 #include "webkit/quota/quota_client.h" | |
15 #include "webkit/quota/quota_manager.h" | |
16 #include "webkit/quota/quota_task.h" | |
17 #include "webkit/quota/quota_types.h" | |
18 | 15 |
19 namespace quota { | 16 namespace quota { |
20 | 17 |
21 class MockQuotaManager::GetModifiedSinceTask : public QuotaThreadTask { | 18 class MockQuotaManager::GetModifiedSinceTask : public QuotaThreadTask { |
22 public: | 19 public: |
23 GetModifiedSinceTask(MockQuotaManager* manager, | 20 GetModifiedSinceTask(MockQuotaManager* manager, |
24 const std::set<GURL>& origins, | 21 const std::set<GURL>& origins, |
25 StorageType type, | 22 StorageType type, |
26 const GetOriginsCallback& callback) | 23 const GetOriginsCallback& callback) |
27 : QuotaThreadTask(manager, manager->io_thread_), | 24 : QuotaThreadTask(manager, manager->io_thread_.get()), |
28 origins_(origins), | 25 origins_(origins), |
29 type_(type), | 26 type_(type), |
30 callback_(callback) {} | 27 callback_(callback) {} |
31 | 28 |
32 protected: | 29 protected: |
33 virtual void RunOnTargetThread() OVERRIDE {} | 30 virtual void RunOnTargetThread() OVERRIDE {} |
34 | 31 |
35 virtual void Completed() OVERRIDE { | 32 virtual void Completed() OVERRIDE { |
36 callback_.Run(origins_, type_); | 33 callback_.Run(origins_, type_); |
37 } | 34 } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 type(type), | 78 type(type), |
82 quota_client_mask(quota_client_mask), | 79 quota_client_mask(quota_client_mask), |
83 modified(modified) { | 80 modified(modified) { |
84 } | 81 } |
85 | 82 |
86 MockQuotaManager::OriginInfo::~OriginInfo() {} | 83 MockQuotaManager::OriginInfo::~OriginInfo() {} |
87 | 84 |
88 MockQuotaManager::MockQuotaManager( | 85 MockQuotaManager::MockQuotaManager( |
89 bool is_incognito, | 86 bool is_incognito, |
90 const FilePath& profile_path, | 87 const FilePath& profile_path, |
91 base::MessageLoopProxy* io_thread, | 88 base::SingleThreadTaskRunner* io_thread, |
92 base::MessageLoopProxy* db_thread, | 89 base::SequencedTaskRunner* db_thread, |
93 SpecialStoragePolicy* special_storage_policy) | 90 SpecialStoragePolicy* special_storage_policy) |
94 : QuotaManager(is_incognito, profile_path, io_thread, db_thread, | 91 : QuotaManager(is_incognito, profile_path, io_thread, db_thread, |
95 special_storage_policy) { | 92 special_storage_policy) { |
96 } | 93 } |
97 | 94 |
98 MockQuotaManager::~MockQuotaManager() {} | 95 MockQuotaManager::~MockQuotaManager() {} |
99 | 96 |
100 bool MockQuotaManager::AddOrigin( | 97 bool MockQuotaManager::AddOrigin( |
101 const GURL& origin, | 98 const GURL& origin, |
102 StorageType type, | 99 StorageType type, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 current->quota_client_mask &= ~quota_client_mask; | 146 current->quota_client_mask &= ~quota_client_mask; |
150 if (current->quota_client_mask == 0) | 147 if (current->quota_client_mask == 0) |
151 origins_.erase(current); | 148 origins_.erase(current); |
152 break; | 149 break; |
153 } | 150 } |
154 } | 151 } |
155 make_scoped_refptr(new DeleteOriginDataTask(this, callback))->Start(); | 152 make_scoped_refptr(new DeleteOriginDataTask(this, callback))->Start(); |
156 } | 153 } |
157 | 154 |
158 } // namespace quota | 155 } // namespace quota |
OLD | NEW |