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

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

Issue 1721813002: Adding DRP specfic UMA for FirstContentfulPaint (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing nits Created 4 years, 9 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_LOADER_H_ 5 #ifndef CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_
6 #define CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_ 6 #define CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "base/timer/timer.h" 11 #include "base/timer/timer.h"
12 #include "content/browser/loader/resource_handler.h" 12 #include "content/browser/loader/resource_handler.h"
13 #include "content/browser/ssl/ssl_client_auth_handler.h" 13 #include "content/browser/ssl/ssl_client_auth_handler.h"
14 #include "content/browser/ssl/ssl_error_handler.h" 14 #include "content/browser/ssl/ssl_error_handler.h"
15 #include "content/common/content_export.h" 15 #include "content/common/content_export.h"
16 #include "content/public/browser/resource_controller.h" 16 #include "content/public/browser/resource_controller.h"
17 #include "content/public/common/signed_certificate_timestamp_id_and_status.h" 17 #include "content/public/common/signed_certificate_timestamp_id_and_status.h"
18 #include "net/url_request/url_request.h" 18 #include "net/url_request/url_request.h"
19 19
20 namespace net { 20 namespace net {
21 class X509Certificate; 21 class X509Certificate;
22 } 22 }
23 23
24 namespace content { 24 namespace content {
25 class ResourceContext;
26 class ResourceDispatcherHostDelegate;
25 class ResourceDispatcherHostLoginDelegate; 27 class ResourceDispatcherHostLoginDelegate;
26 class ResourceLoaderDelegate; 28 class ResourceLoaderDelegate;
27 class ResourceRequestInfoImpl; 29 class ResourceRequestInfoImpl;
28 30
29 // This class is responsible for driving the URLRequest (i.e., calling Start, 31 // This class is responsible for driving the URLRequest (i.e., calling Start,
30 // Read, and servicing events). It has a ResourceHandler, which is typically a 32 // Read, and servicing events). It has a ResourceHandler, which is typically a
31 // chain of ResourceHandlers, and is the ResourceController for its handler. 33 // chain of ResourceHandlers, and is the ResourceController for its handler.
32 class CONTENT_EXPORT ResourceLoader : public net::URLRequest::Delegate, 34 class CONTENT_EXPORT ResourceLoader : public net::URLRequest::Delegate,
33 public SSLErrorHandler::Delegate, 35 public SSLErrorHandler::Delegate,
34 public SSLClientAuthHandler::Delegate, 36 public SSLClientAuthHandler::Delegate,
35 public ResourceController { 37 public ResourceController {
36 public: 38 public:
37 ResourceLoader(scoped_ptr<net::URLRequest> request, 39 ResourceLoader(scoped_ptr<net::URLRequest> request,
38 scoped_ptr<ResourceHandler> handler, 40 scoped_ptr<ResourceHandler> handler,
39 ResourceLoaderDelegate* delegate); 41 ResourceLoaderDelegate* delegate,
42 ResourceDispatcherHostDelegate* host_delegate,
43 ResourceContext* resource_context);
40 ~ResourceLoader() override; 44 ~ResourceLoader() override;
41 45
42 void StartRequest(); 46 void StartRequest();
43 void CancelRequest(bool from_renderer); 47 void CancelRequest(bool from_renderer);
44 48
45 bool is_transferring() const { return is_transferring_; } 49 bool is_transferring() const { return is_transferring_; }
46 void MarkAsTransferring(); 50 void MarkAsTransferring();
47 void CompleteTransfer(); 51 void CompleteTransfer();
48 52
49 net::URLRequest* request() { return request_.get(); } 53 net::URLRequest* request() { return request_.get(); }
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 DEFERRED_REDIRECT, 125 DEFERRED_REDIRECT,
122 DEFERRED_READ, 126 DEFERRED_READ,
123 DEFERRED_RESPONSE_COMPLETE, 127 DEFERRED_RESPONSE_COMPLETE,
124 DEFERRED_FINISH 128 DEFERRED_FINISH
125 }; 129 };
126 DeferredStage deferred_stage_; 130 DeferredStage deferred_stage_;
127 131
128 scoped_ptr<net::URLRequest> request_; 132 scoped_ptr<net::URLRequest> request_;
129 scoped_ptr<ResourceHandler> handler_; 133 scoped_ptr<ResourceHandler> handler_;
130 ResourceLoaderDelegate* delegate_; 134 ResourceLoaderDelegate* delegate_;
135 ResourceDispatcherHostDelegate* host_delegate_;
136 ResourceContext* resource_context_;
131 137
132 scoped_refptr<ResourceDispatcherHostLoginDelegate> login_delegate_; 138 scoped_refptr<ResourceDispatcherHostLoginDelegate> login_delegate_;
133 scoped_ptr<SSLClientAuthHandler> ssl_client_auth_handler_; 139 scoped_ptr<SSLClientAuthHandler> ssl_client_auth_handler_;
134 140
135 base::TimeTicks read_deferral_start_time_; 141 base::TimeTicks read_deferral_start_time_;
136 142
137 // Indicates that we are in a state of being transferred to a new downstream 143 // Indicates that we are in a state of being transferred to a new downstream
138 // consumer. We are waiting for a notification to complete the transfer, at 144 // consumer. We are waiting for a notification to complete the transfer, at
139 // which point we'll receive a new ResourceHandler. 145 // which point we'll receive a new ResourceHandler.
140 bool is_transferring_; 146 bool is_transferring_;
141 147
142 // Instrumentation add to investigate http://crbug.com/503306. 148 // Instrumentation add to investigate http://crbug.com/503306.
143 // TODO(mmenke): Remove once bug is fixed. 149 // TODO(mmenke): Remove once bug is fixed.
144 int times_cancelled_before_request_start_; 150 int times_cancelled_before_request_start_;
145 bool started_request_; 151 bool started_request_;
146 int times_cancelled_after_request_start_; 152 int times_cancelled_after_request_start_;
147 153
148 base::WeakPtrFactory<ResourceLoader> weak_ptr_factory_; 154 base::WeakPtrFactory<ResourceLoader> weak_ptr_factory_;
149 155
150 DISALLOW_COPY_AND_ASSIGN(ResourceLoader); 156 DISALLOW_COPY_AND_ASSIGN(ResourceLoader);
151 }; 157 };
152 158
153 } // namespace content 159 } // namespace content
154 160
155 #endif // CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_ 161 #endif // CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698