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

Side by Side Diff: net/http/http_transaction.h

Issue 122453002: Allows deferral of a URLRequest just before talking to the network, at (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Potential fix of a memory leak due to a reference cycle. Created 6 years, 11 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_HTTP_HTTP_TRANSACTION_H_ 5 #ifndef NET_HTTP_HTTP_TRANSACTION_H_
6 #define NET_HTTP_HTTP_TRANSACTION_H_ 6 #define NET_HTTP_HTTP_TRANSACTION_H_
7 7
8 #include "net/base/completion_callback.h" 8 #include "net/base/completion_callback.h"
9 #include "net/base/load_states.h" 9 #include "net/base/load_states.h"
10 #include "net/base/net_export.h" 10 #include "net/base/net_export.h"
(...skipping 10 matching lines...) Expand all
21 class HttpResponseInfo; 21 class HttpResponseInfo;
22 class IOBuffer; 22 class IOBuffer;
23 struct LoadTimingInfo; 23 struct LoadTimingInfo;
24 class X509Certificate; 24 class X509Certificate;
25 25
26 // Represents a single HTTP transaction (i.e., a single request/response pair). 26 // Represents a single HTTP transaction (i.e., a single request/response pair).
27 // HTTP redirects are not followed and authentication challenges are not 27 // HTTP redirects are not followed and authentication challenges are not
28 // answered. Cookies are assumed to be managed by the caller. 28 // answered. Cookies are assumed to be managed by the caller.
29 class NET_EXPORT_PRIVATE HttpTransaction { 29 class NET_EXPORT_PRIVATE HttpTransaction {
30 public: 30 public:
31 // The bool* is used to inform the caller if it needs to defer or not.
mmenke 2014/01/07 19:44:05 I think this could be clearer. Maybe something li
jkarlin 2014/01/07 20:10:03 Done.
32 typedef base::Callback<void(bool*)> BeforeNetworkStartCallback;
33
31 // Stops any pending IO and destroys the transaction object. 34 // Stops any pending IO and destroys the transaction object.
32 virtual ~HttpTransaction() {} 35 virtual ~HttpTransaction() {}
33 36
34 // Starts the HTTP transaction (i.e., sends the HTTP request). 37 // Starts the HTTP transaction (i.e., sends the HTTP request).
35 // 38 //
36 // Returns OK if the transaction could be started synchronously, which means 39 // Returns OK if the transaction could be started synchronously, which means
37 // that the request was served from the cache. ERR_IO_PENDING is returned to 40 // that the request was served from the cache. ERR_IO_PENDING is returned to
38 // indicate that the CompletionCallback will be notified once response info is 41 // indicate that the CompletionCallback will be notified once response info is
39 // available or if an IO error occurs. Any other return value indicates that 42 // available or if an IO error occurs. Any other return value indicates that
40 // the transaction could not be started. 43 // the transaction could not be started.
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 virtual bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const = 0; 140 virtual bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const = 0;
138 141
139 // Called when the priority of the parent job changes. 142 // Called when the priority of the parent job changes.
140 virtual void SetPriority(RequestPriority priority) = 0; 143 virtual void SetPriority(RequestPriority priority) = 0;
141 144
142 // Set the WebSocketHandshakeStreamBase::CreateHelper to be used for the 145 // Set the WebSocketHandshakeStreamBase::CreateHelper to be used for the
143 // request. Only relevant to WebSocket transactions. Must be called before 146 // request. Only relevant to WebSocket transactions. Must be called before
144 // Start(). Ownership of |create_helper| remains with the caller. 147 // Start(). Ownership of |create_helper| remains with the caller.
145 virtual void SetWebSocketHandshakeStreamCreateHelper( 148 virtual void SetWebSocketHandshakeStreamCreateHelper(
146 WebSocketHandshakeStreamBase::CreateHelper* create_helper) = 0; 149 WebSocketHandshakeStreamBase::CreateHelper* create_helper) = 0;
150
151 // Set the callback to receive notification just before network use.
152 virtual void SetBeforeNetworkStartCallback(
153 const BeforeNetworkStartCallback& callback) = 0;
154
155 // Resumes the transaction after being deferred.
156 virtual int ResumeNetworkStart() = 0;
147 }; 157 };
148 158
149 } // namespace net 159 } // namespace net
150 160
151 #endif // NET_HTTP_HTTP_TRANSACTION_H_ 161 #endif // NET_HTTP_HTTP_TRANSACTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698