| 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 CONTENT_CHILD_QUOTA_DISPATCHER_H_ | 5 #ifndef CONTENT_CHILD_QUOTA_DISPATCHER_H_ |
| 6 #define CONTENT_CHILD_QUOTA_DISPATCHER_H_ | 6 #define CONTENT_CHILD_QUOTA_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> |
| 11 #include <set> | 12 #include <set> |
| 12 | 13 |
| 13 #include "base/id_map.h" | 14 #include "base/id_map.h" |
| 14 #include "base/macros.h" | 15 #include "base/macros.h" |
| 15 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 16 #include "content/public/child/worker_thread.h" | 17 #include "content/public/child/worker_thread.h" |
| 17 #include "storage/common/quota/quota_types.h" | 18 #include "storage/common/quota/quota_types.h" |
| 18 | 19 |
| 19 class GURL; | 20 class GURL; |
| 20 | 21 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 ThreadSafeSender* thread_safe_sender, | 56 ThreadSafeSender* thread_safe_sender, |
| 56 QuotaMessageFilter* quota_message_filter); | 57 QuotaMessageFilter* quota_message_filter); |
| 57 | 58 |
| 58 // WorkerThread::Observer implementation. | 59 // WorkerThread::Observer implementation. |
| 59 void WillStopCurrentWorkerThread() override; | 60 void WillStopCurrentWorkerThread() override; |
| 60 | 61 |
| 61 void OnMessageReceived(const IPC::Message& msg); | 62 void OnMessageReceived(const IPC::Message& msg); |
| 62 | 63 |
| 63 void QueryStorageUsageAndQuota(const GURL& gurl, | 64 void QueryStorageUsageAndQuota(const GURL& gurl, |
| 64 storage::StorageType type, | 65 storage::StorageType type, |
| 65 Callback* callback); | 66 std::unique_ptr<Callback> callback); |
| 66 void RequestStorageQuota(int render_view_id, | 67 void RequestStorageQuota(int render_view_id, |
| 67 const GURL& gurl, | 68 const GURL& gurl, |
| 68 storage::StorageType type, | 69 storage::StorageType type, |
| 69 uint64_t requested_size, | 70 uint64_t requested_size, |
| 70 Callback* callback); | 71 std::unique_ptr<Callback> callback); |
| 71 | 72 |
| 72 // Creates a new Callback instance for WebStorageQuotaCallbacks. | 73 // Creates a new Callback instance for WebStorageQuotaCallbacks. |
| 73 static Callback* CreateWebStorageQuotaCallbacksWrapper( | 74 static std::unique_ptr<Callback> CreateWebStorageQuotaCallbacksWrapper( |
| 74 blink::WebStorageQuotaCallbacks callbacks); | 75 blink::WebStorageQuotaCallbacks callbacks); |
| 75 | 76 |
| 76 private: | 77 private: |
| 77 // Message handlers. | 78 // Message handlers. |
| 78 void DidQueryStorageUsageAndQuota(int request_id, | 79 void DidQueryStorageUsageAndQuota(int request_id, |
| 79 int64_t current_usage, | 80 int64_t current_usage, |
| 80 int64_t current_quota); | 81 int64_t current_quota); |
| 81 void DidGrantStorageQuota(int request_id, | 82 void DidGrantStorageQuota(int request_id, |
| 82 int64_t current_usage, | 83 int64_t current_usage, |
| 83 int64_t granted_quota); | 84 int64_t granted_quota); |
| 84 void DidFail(int request_id, storage::QuotaStatusCode error); | 85 void DidFail(int request_id, storage::QuotaStatusCode error); |
| 85 | 86 |
| 86 IDMap<Callback, IDMapOwnPointer> pending_quota_callbacks_; | 87 IDMap<Callback, IDMapOwnPointer> pending_quota_callbacks_; |
| 87 | 88 |
| 88 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 89 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
| 89 scoped_refptr<QuotaMessageFilter> quota_message_filter_; | 90 scoped_refptr<QuotaMessageFilter> quota_message_filter_; |
| 90 | 91 |
| 91 DISALLOW_COPY_AND_ASSIGN(QuotaDispatcher); | 92 DISALLOW_COPY_AND_ASSIGN(QuotaDispatcher); |
| 92 }; | 93 }; |
| 93 | 94 |
| 94 } // namespace content | 95 } // namespace content |
| 95 | 96 |
| 96 #endif // CONTENT_CHILD_QUOTA_DISPATCHER_H_ | 97 #endif // CONTENT_CHILD_QUOTA_DISPATCHER_H_ |
| OLD | NEW |