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