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_THROTTLING_RESOURCE_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_LOADER_THROTTLING_RESOURCE_HANDLER_H_ |
6 #define CONTENT_BROWSER_LOADER_THROTTLING_RESOURCE_HANDLER_H_ | 6 #define CONTENT_BROWSER_LOADER_THROTTLING_RESOURCE_HANDLER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 net::URLRequest* request, | 32 net::URLRequest* request, |
33 ScopedVector<ResourceThrottle> throttles); | 33 ScopedVector<ResourceThrottle> throttles); |
34 ~ThrottlingResourceHandler() override; | 34 ~ThrottlingResourceHandler() override; |
35 | 35 |
36 // LayeredResourceHandler overrides: | 36 // LayeredResourceHandler overrides: |
37 bool OnRequestRedirected(const net::RedirectInfo& redirect_info, | 37 bool OnRequestRedirected(const net::RedirectInfo& redirect_info, |
38 ResourceResponse* response, | 38 ResourceResponse* response, |
39 bool* defer) override; | 39 bool* defer) override; |
40 bool OnResponseStarted(ResourceResponse* response, bool* defer) override; | 40 bool OnResponseStarted(ResourceResponse* response, bool* defer) override; |
41 bool OnWillStart(const GURL& url, bool* defer) override; | 41 bool OnWillStart(const GURL& url, bool* defer) override; |
42 bool OnBeforeNetworkStart(const GURL& url, bool* defer) override; | |
43 | 42 |
44 // ResourceController implementation: | 43 // ResourceController implementation: |
45 void Cancel() override; | 44 void Cancel() override; |
46 void CancelAndIgnore() override; | 45 void CancelAndIgnore() override; |
47 void CancelWithError(int error_code) override; | 46 void CancelWithError(int error_code) override; |
48 void Resume() override; | 47 void Resume() override; |
49 | 48 |
50 private: | 49 private: |
51 void ResumeStart(); | 50 void ResumeStart(); |
52 void ResumeNetworkStart(); | |
53 void ResumeRedirect(); | 51 void ResumeRedirect(); |
54 void ResumeResponse(); | 52 void ResumeResponse(); |
55 | 53 |
56 // Called when the throttle at |throttle_index| defers a request. Logs the | 54 // Called when the throttle at |throttle_index| defers a request. Logs the |
57 // name of the throttle that delayed the request. | 55 // name of the throttle that delayed the request. |
58 void OnRequestDefered(int throttle_index); | 56 void OnRequestDefered(int throttle_index); |
59 | 57 |
60 enum DeferredStage { | 58 enum DeferredStage { |
61 DEFERRED_NONE, | 59 DEFERRED_NONE, |
62 DEFERRED_START, | 60 DEFERRED_START, |
63 DEFERRED_NETWORK_START, | |
64 DEFERRED_REDIRECT, | 61 DEFERRED_REDIRECT, |
65 DEFERRED_RESPONSE | 62 DEFERRED_RESPONSE |
66 }; | 63 }; |
67 DeferredStage deferred_stage_; | 64 DeferredStage deferred_stage_; |
68 | 65 |
69 ScopedVector<ResourceThrottle> throttles_; | 66 ScopedVector<ResourceThrottle> throttles_; |
70 size_t next_index_; | 67 size_t next_index_; |
71 | 68 |
72 GURL deferred_url_; | 69 GURL deferred_url_; |
73 net::RedirectInfo deferred_redirect_; | 70 net::RedirectInfo deferred_redirect_; |
74 scoped_refptr<ResourceResponse> deferred_response_; | 71 scoped_refptr<ResourceResponse> deferred_response_; |
75 | 72 |
76 bool cancelled_by_resource_throttle_; | 73 bool cancelled_by_resource_throttle_; |
77 }; | 74 }; |
78 | 75 |
79 } // namespace content | 76 } // namespace content |
80 | 77 |
81 #endif // CONTENT_BROWSER_LOADER_THROTTLING_RESOURCE_HANDLER_H_ | 78 #endif // CONTENT_BROWSER_LOADER_THROTTLING_RESOURCE_HANDLER_H_ |
OLD | NEW |