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 #ifndef CONTENT_BROWSER_LOADER_RESOURCE_MESSAGE_FILTER_H_ | 5 #ifndef CONTENT_BROWSER_LOADER_RESOURCE_MESSAGE_FILTER_H_ |
6 #define CONTENT_BROWSER_LOADER_RESOURCE_MESSAGE_FILTER_H_ | 6 #define CONTENT_BROWSER_LOADER_RESOURCE_MESSAGE_FILTER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/sequenced_task_runner_helpers.h" |
13 #include "content/browser/host_zoom_level_context.h" | 14 #include "content/browser/host_zoom_level_context.h" |
14 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
15 #include "content/public/browser/browser_message_filter.h" | 16 #include "content/public/browser/browser_message_filter.h" |
| 17 #include "content/public/browser/browser_thread.h" |
16 #include "content/public/common/resource_type.h" | 18 #include "content/public/common/resource_type.h" |
17 | 19 |
18 namespace storage { | 20 namespace storage { |
19 class FileSystemContext; | 21 class FileSystemContext; |
20 } // namespace storage | 22 } // namespace storage |
21 | 23 |
22 namespace net { | 24 namespace net { |
23 class URLRequestContext; | 25 class URLRequestContext; |
24 } // namespace net | 26 } // namespace net |
25 | 27 |
(...skipping 25 matching lines...) Expand all Loading... |
51 ChromeAppCacheService* appcache_service, | 53 ChromeAppCacheService* appcache_service, |
52 ChromeBlobStorageContext* blob_storage_context, | 54 ChromeBlobStorageContext* blob_storage_context, |
53 storage::FileSystemContext* file_system_context, | 55 storage::FileSystemContext* file_system_context, |
54 ServiceWorkerContextWrapper* service_worker_context, | 56 ServiceWorkerContextWrapper* service_worker_context, |
55 HostZoomLevelContext* host_zoom_level_context, | 57 HostZoomLevelContext* host_zoom_level_context, |
56 const GetContextsCallback& get_contexts_callback); | 58 const GetContextsCallback& get_contexts_callback); |
57 | 59 |
58 // BrowserMessageFilter implementation. | 60 // BrowserMessageFilter implementation. |
59 void OnChannelClosing() override; | 61 void OnChannelClosing() override; |
60 bool OnMessageReceived(const IPC::Message& message) override; | 62 bool OnMessageReceived(const IPC::Message& message) override; |
| 63 void OnDestruct() const override; |
61 | 64 |
62 void GetContexts(ResourceType resource_type, | 65 void GetContexts(ResourceType resource_type, |
63 ResourceContext** resource_context, | 66 ResourceContext** resource_context, |
64 net::URLRequestContext** request_context); | 67 net::URLRequestContext** request_context); |
65 | 68 |
66 // Returns the net::URLRequestContext for the given request. | 69 // Returns the net::URLRequestContext for the given request. |
67 net::URLRequestContext* GetURLRequestContext(ResourceType request_type); | 70 net::URLRequestContext* GetURLRequestContext(ResourceType request_type); |
68 | 71 |
69 ChromeAppCacheService* appcache_service() const { | 72 ChromeAppCacheService* appcache_service() const { |
70 return appcache_service_.get(); | 73 return appcache_service_.get(); |
(...skipping 18 matching lines...) Expand all Loading... |
89 int child_id() const { return child_id_; } | 92 int child_id() const { return child_id_; } |
90 int process_type() const { return process_type_; } | 93 int process_type() const { return process_type_; } |
91 | 94 |
92 base::WeakPtr<ResourceMessageFilter> GetWeakPtr(); | 95 base::WeakPtr<ResourceMessageFilter> GetWeakPtr(); |
93 | 96 |
94 protected: | 97 protected: |
95 // Protected destructor so that we can be overriden in tests. | 98 // Protected destructor so that we can be overriden in tests. |
96 ~ResourceMessageFilter() override; | 99 ~ResourceMessageFilter() override; |
97 | 100 |
98 private: | 101 private: |
| 102 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>; |
| 103 friend class base::DeleteHelper<ResourceMessageFilter>; |
| 104 |
99 // The ID of the child process. | 105 // The ID of the child process. |
100 int child_id_; | 106 int child_id_; |
101 | 107 |
102 int process_type_; | 108 int process_type_; |
103 | 109 |
104 scoped_refptr<ChromeAppCacheService> appcache_service_; | 110 scoped_refptr<ChromeAppCacheService> appcache_service_; |
105 scoped_refptr<ChromeBlobStorageContext> blob_storage_context_; | 111 scoped_refptr<ChromeBlobStorageContext> blob_storage_context_; |
106 scoped_refptr<storage::FileSystemContext> file_system_context_; | 112 scoped_refptr<storage::FileSystemContext> file_system_context_; |
107 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; | 113 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; |
108 scoped_refptr<HostZoomLevelContext> host_zoom_level_context_; | 114 scoped_refptr<HostZoomLevelContext> host_zoom_level_context_; |
109 | 115 |
110 GetContextsCallback get_contexts_callback_; | 116 GetContextsCallback get_contexts_callback_; |
111 | 117 |
112 // This must come last to make sure weak pointers are invalidated first. | 118 // This must come last to make sure weak pointers are invalidated first. |
113 base::WeakPtrFactory<ResourceMessageFilter> weak_ptr_factory_; | 119 base::WeakPtrFactory<ResourceMessageFilter> weak_ptr_factory_; |
114 | 120 |
115 DISALLOW_IMPLICIT_CONSTRUCTORS(ResourceMessageFilter); | 121 DISALLOW_IMPLICIT_CONSTRUCTORS(ResourceMessageFilter); |
116 }; | 122 }; |
117 | 123 |
118 } // namespace content | 124 } // namespace content |
119 | 125 |
120 #endif // CONTENT_BROWSER_LOADER_RESOURCE_MESSAGE_FILTER_H_ | 126 #endif // CONTENT_BROWSER_LOADER_RESOURCE_MESSAGE_FILTER_H_ |
OLD | NEW |