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

Side by Side Diff: net/base/network_delegate.h

Issue 15675002: Add the UMA recording recall of URLRequests preconnected. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: style fix Created 7 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 NET_BASE_NETWORK_DELEGATE_H_ 5 #ifndef NET_BASE_NETWORK_DELEGATE_H_
6 #define NET_BASE_NETWORK_DELEGATE_H_ 6 #define NET_BASE_NETWORK_DELEGATE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 REQUEST_WAIT_STATE_NETWORK_FINISH, 58 REQUEST_WAIT_STATE_NETWORK_FINISH,
59 REQUEST_WAIT_STATE_RESET 59 REQUEST_WAIT_STATE_RESET
60 }; 60 };
61 61
62 virtual ~NetworkDelegate() {} 62 virtual ~NetworkDelegate() {}
63 63
64 // Notification interface called by the network stack. Note that these 64 // Notification interface called by the network stack. Note that these
65 // functions mostly forward to the private virtuals. They also add some sanity 65 // functions mostly forward to the private virtuals. They also add some sanity
66 // checking on parameters. See the corresponding virtuals for explanations of 66 // checking on parameters. See the corresponding virtuals for explanations of
67 // the methods and their arguments. 67 // the methods and their arguments.
68 void NotifyBeforePreconnect(const GURL& url);
mmenke 2013/05/22 17:58:43 This is an interface for the network stack, in net
kouhei (in TOK) 2013/05/23 07:31:13 ok.
68 int NotifyBeforeURLRequest(URLRequest* request, 69 int NotifyBeforeURLRequest(URLRequest* request,
69 const CompletionCallback& callback, 70 const CompletionCallback& callback,
70 GURL* new_url); 71 GURL* new_url);
71 int NotifyBeforeSendHeaders(URLRequest* request, 72 int NotifyBeforeSendHeaders(URLRequest* request,
72 const CompletionCallback& callback, 73 const CompletionCallback& callback,
73 HttpRequestHeaders* headers); 74 HttpRequestHeaders* headers);
74 void NotifySendHeaders(URLRequest* request, 75 void NotifySendHeaders(URLRequest* request,
75 const HttpRequestHeaders& headers); 76 const HttpRequestHeaders& headers);
76 int NotifyHeadersReceived( 77 int NotifyHeadersReceived(
77 URLRequest* request, 78 URLRequest* request,
(...skipping 26 matching lines...) Expand all
104 const CompletionCallback& callback); 105 const CompletionCallback& callback);
105 106
106 void NotifyRequestWaitStateChange(const URLRequest& request, 107 void NotifyRequestWaitStateChange(const URLRequest& request,
107 RequestWaitState state); 108 RequestWaitState state);
108 109
109 private: 110 private:
110 // This is the interface for subclasses of NetworkDelegate to implement. These 111 // This is the interface for subclasses of NetworkDelegate to implement. These
111 // member functions will be called by the respective public notification 112 // member functions will be called by the respective public notification
112 // member function, which will perform basic sanity checking. 113 // member function, which will perform basic sanity checking.
113 114
115 // Called before a preconnect is processed.
116 virtual void OnBeforePreconnect(const GURL& url) {}
117
114 // Called before a request is sent. Allows the delegate to rewrite the URL 118 // Called before a request is sent. Allows the delegate to rewrite the URL
115 // being fetched by modifying |new_url|. |callback| and |new_url| are valid 119 // being fetched by modifying |new_url|. |callback| and |new_url| are valid
116 // only until OnURLRequestDestroyed is called for this request. Returns a net 120 // only until OnURLRequestDestroyed is called for this request. Returns a net
117 // status code, generally either OK to continue with the request or 121 // status code, generally either OK to continue with the request or
118 // ERR_IO_PENDING if the result is not ready yet. A status code other than OK 122 // ERR_IO_PENDING if the result is not ready yet. A status code other than OK
119 // and ERR_IO_PENDING will cancel the request and report the status code as 123 // and ERR_IO_PENDING will cancel the request and report the status code as
120 // the reason. 124 // the reason.
121 virtual int OnBeforeURLRequest(URLRequest* request, 125 virtual int OnBeforeURLRequest(URLRequest* request,
122 const CompletionCallback& callback, 126 const CompletionCallback& callback,
123 GURL* new_url) = 0; 127 GURL* new_url) = 0;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 // action or a network action, or when that is no longer the case. 246 // action or a network action, or when that is no longer the case.
243 // REQUEST_WAIT_STATE_RESET indicates for a given URLRequest 247 // REQUEST_WAIT_STATE_RESET indicates for a given URLRequest
244 // cancellation of any pending waits for this request. 248 // cancellation of any pending waits for this request.
245 virtual void OnRequestWaitStateChange(const URLRequest& request, 249 virtual void OnRequestWaitStateChange(const URLRequest& request,
246 RequestWaitState state) = 0; 250 RequestWaitState state) = 0;
247 }; 251 };
248 252
249 } // namespace net 253 } // namespace net
250 254
251 #endif // NET_BASE_NETWORK_DELEGATE_H_ 255 #endif // NET_BASE_NETWORK_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698