Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(665)

Side by Side Diff: content/browser/loader/resource_message_filter.h

Issue 1970693002: Use mojo for Chrome Loading, Part 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/common/content_export.h" 14 #include "content/common/content_export.h"
15 #include "content/common/url_loader.mojom.h"
14 #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"
15 #include "content/public/common/resource_type.h" 18 #include "content/public/common/resource_type.h"
16 19
17 namespace storage { 20 namespace storage {
18 class FileSystemContext; 21 class FileSystemContext;
19 } // namespace storage 22 } // namespace storage
20 23
21 namespace net { 24 namespace net {
22 class URLRequestContext; 25 class URLRequestContext;
23 } // namespace net 26 } // namespace net
24 27
(...skipping 27 matching lines...) Expand all
52 int process_type, 55 int process_type,
53 ChromeAppCacheService* appcache_service, 56 ChromeAppCacheService* appcache_service,
54 ChromeBlobStorageContext* blob_storage_context, 57 ChromeBlobStorageContext* blob_storage_context,
55 storage::FileSystemContext* file_system_context, 58 storage::FileSystemContext* file_system_context,
56 ServiceWorkerContextWrapper* service_worker_context, 59 ServiceWorkerContextWrapper* service_worker_context,
57 const GetContextsCallback& get_contexts_callback); 60 const GetContextsCallback& get_contexts_callback);
58 61
59 // BrowserMessageFilter implementation. 62 // BrowserMessageFilter implementation.
60 void OnChannelClosing() override; 63 void OnChannelClosing() override;
61 bool OnMessageReceived(const IPC::Message& message) override; 64 bool OnMessageReceived(const IPC::Message& message) override;
65 void OnDestruct() const override;
62 66
63 // |origin_pid| is only required for NPAPI plugin processes. Its value is 67 // |origin_pid| is only required for NPAPI plugin processes. Its value is
64 // ignored otherwise. 68 // ignored otherwise.
65 void GetContexts(ResourceType resource_type, 69 void GetContexts(ResourceType resource_type,
66 int origin_pid, 70 int origin_pid,
67 ResourceContext** resource_context, 71 ResourceContext** resource_context,
68 net::URLRequestContext** request_context); 72 net::URLRequestContext** request_context);
69 73
70 // Returns the net::URLRequestContext for the given request. 74 // Returns the net::URLRequestContext for the given request.
71 net::URLRequestContext* GetURLRequestContext(ResourceType request_type); 75 net::URLRequestContext* GetURLRequestContext(ResourceType request_type);
(...skipping 10 matching lines...) Expand all
82 return file_system_context_.get(); 86 return file_system_context_.get();
83 } 87 }
84 88
85 ServiceWorkerContextWrapper* service_worker_context() const { 89 ServiceWorkerContextWrapper* service_worker_context() const {
86 return service_worker_context_.get(); 90 return service_worker_context_.get();
87 } 91 }
88 92
89 int child_id() const { return child_id_; } 93 int child_id() const { return child_id_; }
90 int process_type() const { return process_type_; } 94 int process_type() const { return process_type_; }
91 95
96 // IPC::Sender
97 bool Send(IPC::Message* message) override;
98
92 base::WeakPtr<ResourceMessageFilter> GetWeakPtr(); 99 base::WeakPtr<ResourceMessageFilter> GetWeakPtr();
93 100
94 protected: 101 protected:
95 // Protected destructor so that we can be overriden in tests. 102 // Protected destructor so that we can be overriden in tests.
96 ~ResourceMessageFilter() override; 103 ~ResourceMessageFilter() override;
97 104
98 private: 105 private:
106 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>;
107 friend class base::DeleteHelper<ResourceMessageFilter>;
108
109 bool SendWithMojo(mojom::URLLoaderClient* client,
110 const IPC::Message& message);
111
99 // The ID of the child process. 112 // The ID of the child process.
100 int child_id_; 113 int child_id_;
101 114
102 int process_type_; 115 int process_type_;
103 116
104 scoped_refptr<ChromeAppCacheService> appcache_service_; 117 scoped_refptr<ChromeAppCacheService> appcache_service_;
105 scoped_refptr<ChromeBlobStorageContext> blob_storage_context_; 118 scoped_refptr<ChromeBlobStorageContext> blob_storage_context_;
106 scoped_refptr<storage::FileSystemContext> file_system_context_; 119 scoped_refptr<storage::FileSystemContext> file_system_context_;
107 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; 120 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_;
108 121
109 GetContextsCallback get_contexts_callback_; 122 GetContextsCallback get_contexts_callback_;
110 123
111 // 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.
112 base::WeakPtrFactory<ResourceMessageFilter> weak_ptr_factory_; 125 base::WeakPtrFactory<ResourceMessageFilter> weak_ptr_factory_;
113 126
114 DISALLOW_IMPLICIT_CONSTRUCTORS(ResourceMessageFilter); 127 DISALLOW_IMPLICIT_CONSTRUCTORS(ResourceMessageFilter);
115 }; 128 };
116 129
117 } // namespace content 130 } // namespace content
118 131
119 #endif // CONTENT_BROWSER_LOADER_RESOURCE_MESSAGE_FILTER_H_ 132 #endif // CONTENT_BROWSER_LOADER_RESOURCE_MESSAGE_FILTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698