| 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 // This is the browser side of the resource dispatcher, it receives requests | 5 // This is the browser side of the resource dispatcher, it receives requests |
| 6 // from the RenderProcessHosts, and dispatches them to URLRequests. It then | 6 // from the RenderProcessHosts, and dispatches them to URLRequests. It then |
| 7 // fowards the messages from the URLRequests back to the correct process for | 7 // fowards the messages from the URLRequests back to the correct process for |
| 8 // handling. | 8 // handling. |
| 9 // | 9 // |
| 10 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading | 10 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading |
| 11 | 11 |
| 12 #ifndef CONTENT_BROWSER_LOADER_RESOURCE_HANDLER_H_ | 12 #ifndef CONTENT_BROWSER_LOADER_RESOURCE_HANDLER_H_ |
| 13 #define CONTENT_BROWSER_LOADER_RESOURCE_HANDLER_H_ | 13 #define CONTENT_BROWSER_LOADER_RESOURCE_HANDLER_H_ |
| 14 | 14 |
| 15 #include <memory> | 15 #include <memory> |
| 16 #include <string> | 16 #include <string> |
| 17 | 17 |
| 18 #include "base/compiler_specific.h" | 18 #include "base/compiler_specific.h" |
| 19 #include "base/macros.h" | 19 #include "base/macros.h" |
| 20 #include "base/memory/ref_counted.h" | 20 #include "base/memory/ref_counted.h" |
| 21 #include "base/threading/non_thread_safe.h" | 21 #include "base/sequence_checker.h" |
| 22 #include "content/browser/loader/resource_controller.h" | 22 #include "content/browser/loader/resource_controller.h" |
| 23 #include "content/common/content_export.h" | 23 #include "content/common/content_export.h" |
| 24 | 24 |
| 25 class GURL; | 25 class GURL; |
| 26 | 26 |
| 27 namespace net { | 27 namespace net { |
| 28 class IOBuffer; | 28 class IOBuffer; |
| 29 class URLRequest; | 29 class URLRequest; |
| 30 class URLRequestStatus; | 30 class URLRequestStatus; |
| 31 struct RedirectInfo; | 31 struct RedirectInfo; |
| 32 } // namespace net | 32 } // namespace net |
| 33 | 33 |
| 34 namespace content { | 34 namespace content { |
| 35 class ResourceMessageFilter; | 35 class ResourceMessageFilter; |
| 36 class ResourceRequestInfoImpl; | 36 class ResourceRequestInfoImpl; |
| 37 struct ResourceResponse; | 37 struct ResourceResponse; |
| 38 | 38 |
| 39 // The resource dispatcher host uses this interface to process network events | 39 // The resource dispatcher host uses this interface to process network events |
| 40 // for an URLRequest instance. A ResourceHandler's lifetime is bound to its | 40 // for an URLRequest instance. A ResourceHandler's lifetime is bound to its |
| 41 // associated URLRequest. | 41 // associated URLRequest. |
| 42 // | 42 // |
| 43 // No ResourceHandler method other than OnWillRead will ever be called | 43 // No ResourceHandler method other than OnWillRead will ever be called |
| 44 // synchronously when it calls into the ResourceController passed in to it, | 44 // synchronously when it calls into the ResourceController passed in to it, |
| 45 // either to resume or cancel the request. | 45 // either to resume or cancel the request. |
| 46 class CONTENT_EXPORT ResourceHandler | 46 class CONTENT_EXPORT ResourceHandler { |
| 47 : public NON_EXPORTED_BASE(base::NonThreadSafe) { | |
| 48 public: | 47 public: |
| 49 virtual ~ResourceHandler(); | 48 virtual ~ResourceHandler(); |
| 50 | 49 |
| 51 // Used to allow a ResourceHandler to cancel the request out of band, when it | 50 // Used to allow a ResourceHandler to cancel the request out of band, when it |
| 52 // may not have a ResourceController. | 51 // may not have a ResourceController. |
| 53 class CONTENT_EXPORT Delegate { | 52 class CONTENT_EXPORT Delegate { |
| 54 protected: | 53 protected: |
| 55 Delegate(); | 54 Delegate(); |
| 56 virtual ~Delegate(); | 55 virtual ~Delegate(); |
| 57 | 56 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 int GetRequestID() const; | 168 int GetRequestID() const; |
| 170 ResourceMessageFilter* GetFilter() const; | 169 ResourceMessageFilter* GetFilter() const; |
| 171 | 170 |
| 172 Delegate* delegate() { return delegate_; } | 171 Delegate* delegate() { return delegate_; } |
| 173 | 172 |
| 174 private: | 173 private: |
| 175 net::URLRequest* request_; | 174 net::URLRequest* request_; |
| 176 Delegate* delegate_; | 175 Delegate* delegate_; |
| 177 std::unique_ptr<ResourceController> controller_; | 176 std::unique_ptr<ResourceController> controller_; |
| 178 | 177 |
| 178 SEQUENCE_CHECKER(sequence_checker_); |
| 179 |
| 179 DISALLOW_COPY_AND_ASSIGN(ResourceHandler); | 180 DISALLOW_COPY_AND_ASSIGN(ResourceHandler); |
| 180 }; | 181 }; |
| 181 | 182 |
| 182 } // namespace content | 183 } // namespace content |
| 183 | 184 |
| 184 #endif // CONTENT_BROWSER_LOADER_RESOURCE_HANDLER_H_ | 185 #endif // CONTENT_BROWSER_LOADER_RESOURCE_HANDLER_H_ |
| OLD | NEW |