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/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/sequenced_task_runner_helpers.h" | 14 #include "base/sequenced_task_runner_helpers.h" |
15 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
16 #include "content/common/url_loader_factory.mojom.h" | 16 #include "content/common/url_loader_factory.mojom.h" |
17 #include "content/public/browser/browser_associated_interface.h" | 17 #include "content/public/browser/browser_associated_interface.h" |
18 #include "content/public/browser/browser_message_filter.h" | 18 #include "content/public/browser/browser_message_filter.h" |
19 #include "content/public/browser/browser_thread.h" | |
20 #include "content/public/common/resource_type.h" | 19 #include "content/public/common/resource_type.h" |
21 | 20 |
22 namespace storage { | 21 namespace storage { |
23 class FileSystemContext; | 22 class FileSystemContext; |
24 } // namespace storage | 23 } // namespace storage |
25 | 24 |
26 namespace net { | 25 namespace net { |
27 class URLRequestContext; | 26 class URLRequestContext; |
28 } // namespace net | 27 } // namespace net |
29 | 28 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 ResourceRequesterInfo* requester_info_for_test() { | 81 ResourceRequesterInfo* requester_info_for_test() { |
83 return requester_info_.get(); | 82 return requester_info_.get(); |
84 } | 83 } |
85 void InitializeForTest(); | 84 void InitializeForTest(); |
86 | 85 |
87 protected: | 86 protected: |
88 // Protected destructor so that we can be overriden in tests. | 87 // Protected destructor so that we can be overriden in tests. |
89 ~ResourceMessageFilter() override; | 88 ~ResourceMessageFilter() override; |
90 | 89 |
91 private: | 90 private: |
92 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>; | |
93 friend class base::DeleteHelper<ResourceMessageFilter>; | 91 friend class base::DeleteHelper<ResourceMessageFilter>; |
94 | 92 |
95 // Initializes the weak pointer of this filter in |requester_info_|. | 93 // Initializes the weak pointer of this filter in |requester_info_|. |
96 void InitializeOnIOThread(); | 94 void InitializeOnIOThread(); |
97 | 95 |
98 bool is_channel_closed_; | 96 bool is_channel_closed_; |
99 scoped_refptr<ResourceRequesterInfo> requester_info_; | 97 scoped_refptr<ResourceRequesterInfo> requester_info_; |
100 | 98 |
101 // This must come last to make sure weak pointers are invalidated first. | 99 // This must come last to make sure weak pointers are invalidated first. |
102 base::WeakPtrFactory<ResourceMessageFilter> weak_ptr_factory_; | 100 base::WeakPtrFactory<ResourceMessageFilter> weak_ptr_factory_; |
103 | 101 |
104 DISALLOW_IMPLICIT_CONSTRUCTORS(ResourceMessageFilter); | 102 DISALLOW_IMPLICIT_CONSTRUCTORS(ResourceMessageFilter); |
105 }; | 103 }; |
106 | 104 |
107 } // namespace content | 105 } // namespace content |
108 | 106 |
109 #endif // CONTENT_BROWSER_LOADER_RESOURCE_MESSAGE_FILTER_H_ | 107 #endif // CONTENT_BROWSER_LOADER_RESOURCE_MESSAGE_FILTER_H_ |
OLD | NEW |