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 28 matching lines...) Expand all Loading... |
54 ChromeAppCacheService* appcache_service, | 56 ChromeAppCacheService* appcache_service, |
55 ChromeBlobStorageContext* blob_storage_context, | 57 ChromeBlobStorageContext* blob_storage_context, |
56 storage::FileSystemContext* file_system_context, | 58 storage::FileSystemContext* file_system_context, |
57 ServiceWorkerContextWrapper* service_worker_context, | 59 ServiceWorkerContextWrapper* service_worker_context, |
58 HostZoomLevelContext* host_zoom_level_context, | 60 HostZoomLevelContext* host_zoom_level_context, |
59 const GetContextsCallback& get_contexts_callback); | 61 const GetContextsCallback& get_contexts_callback); |
60 | 62 |
61 // BrowserMessageFilter implementation. | 63 // BrowserMessageFilter implementation. |
62 void OnChannelClosing() override; | 64 void OnChannelClosing() override; |
63 bool OnMessageReceived(const IPC::Message& message) override; | 65 bool OnMessageReceived(const IPC::Message& message) override; |
| 66 void OnDestruct() const override; |
64 | 67 |
65 // |origin_pid| is only required for NPAPI plugin processes. Its value is | 68 // |origin_pid| is only required for NPAPI plugin processes. Its value is |
66 // ignored otherwise. | 69 // ignored otherwise. |
67 void GetContexts(ResourceType resource_type, | 70 void GetContexts(ResourceType resource_type, |
68 int origin_pid, | 71 int origin_pid, |
69 ResourceContext** resource_context, | 72 ResourceContext** resource_context, |
70 net::URLRequestContext** request_context); | 73 net::URLRequestContext** request_context); |
71 | 74 |
72 // Returns the net::URLRequestContext for the given request. | 75 // Returns the net::URLRequestContext for the given request. |
73 net::URLRequestContext* GetURLRequestContext(ResourceType request_type); | 76 net::URLRequestContext* GetURLRequestContext(ResourceType request_type); |
(...skipping 21 matching lines...) Expand all Loading... |
95 int child_id() const { return child_id_; } | 98 int child_id() const { return child_id_; } |
96 int process_type() const { return process_type_; } | 99 int process_type() const { return process_type_; } |
97 | 100 |
98 base::WeakPtr<ResourceMessageFilter> GetWeakPtr(); | 101 base::WeakPtr<ResourceMessageFilter> GetWeakPtr(); |
99 | 102 |
100 protected: | 103 protected: |
101 // Protected destructor so that we can be overriden in tests. | 104 // Protected destructor so that we can be overriden in tests. |
102 ~ResourceMessageFilter() override; | 105 ~ResourceMessageFilter() override; |
103 | 106 |
104 private: | 107 private: |
| 108 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>; |
| 109 friend class base::DeleteHelper<ResourceMessageFilter>; |
| 110 |
105 // The ID of the child process. | 111 // The ID of the child process. |
106 int child_id_; | 112 int child_id_; |
107 | 113 |
108 int process_type_; | 114 int process_type_; |
109 | 115 |
110 scoped_refptr<ChromeAppCacheService> appcache_service_; | 116 scoped_refptr<ChromeAppCacheService> appcache_service_; |
111 scoped_refptr<ChromeBlobStorageContext> blob_storage_context_; | 117 scoped_refptr<ChromeBlobStorageContext> blob_storage_context_; |
112 scoped_refptr<storage::FileSystemContext> file_system_context_; | 118 scoped_refptr<storage::FileSystemContext> file_system_context_; |
113 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; | 119 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; |
114 scoped_refptr<HostZoomLevelContext> host_zoom_level_context_; | 120 scoped_refptr<HostZoomLevelContext> host_zoom_level_context_; |
115 | 121 |
116 GetContextsCallback get_contexts_callback_; | 122 GetContextsCallback get_contexts_callback_; |
117 | 123 |
118 // This must come last to make sure weak pointers are invalidated first. | 124 // This must come last to make sure weak pointers are invalidated first. |
119 base::WeakPtrFactory<ResourceMessageFilter> weak_ptr_factory_; | 125 base::WeakPtrFactory<ResourceMessageFilter> weak_ptr_factory_; |
120 | 126 |
121 DISALLOW_IMPLICIT_CONSTRUCTORS(ResourceMessageFilter); | 127 DISALLOW_IMPLICIT_CONSTRUCTORS(ResourceMessageFilter); |
122 }; | 128 }; |
123 | 129 |
124 } // namespace content | 130 } // namespace content |
125 | 131 |
126 #endif // CONTENT_BROWSER_LOADER_RESOURCE_MESSAGE_FILTER_H_ | 132 #endif // CONTENT_BROWSER_LOADER_RESOURCE_MESSAGE_FILTER_H_ |
OLD | NEW |