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

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

Issue 42541: Prioritize which HTTP requests get a socket first by adding a priority level ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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_CLIENT_SOCKET_HANDLE_H_ 5 #ifndef NET_BASE_CLIENT_SOCKET_HANDLE_H_
6 #define NET_BASE_CLIENT_SOCKET_HANDLE_H_ 6 #define NET_BASE_CLIENT_SOCKET_HANDLE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/ref_counted.h" 10 #include "base/ref_counted.h"
(...skipping 14 matching lines...) Expand all
25 // A handle is initialized with a null socket. It is the consumer's job to 25 // A handle is initialized with a null socket. It is the consumer's job to
26 // initialize a ClientSocket object and set it on the handle. 26 // initialize a ClientSocket object and set it on the handle.
27 // 27 //
28 class ClientSocketHandle { 28 class ClientSocketHandle {
29 public: 29 public:
30 explicit ClientSocketHandle(ClientSocketPool* pool); 30 explicit ClientSocketHandle(ClientSocketPool* pool);
31 ~ClientSocketHandle(); 31 ~ClientSocketHandle();
32 32
33 // Initializes a ClientSocketHandle object, which involves talking to the 33 // Initializes a ClientSocketHandle object, which involves talking to the
34 // ClientSocketPool to locate a socket to possibly reuse. This method 34 // ClientSocketPool to locate a socket to possibly reuse. This method
35 // returns either OK or ERR_IO_PENDING. 35 // returns either OK or ERR_IO_PENDING. On ERR_IO_PENDING, |priority| is
36 // used to determine the placement in ClientSocketPool's wait list.
36 // 37 //
37 // If this method succeeds, then the socket member will be set to an existing 38 // If this method succeeds, then the socket member will be set to an existing
38 // socket if an existing socket was available to reuse. Otherwise, the 39 // socket if an existing socket was available to reuse. Otherwise, the
39 // consumer should set the socket member of this handle. 40 // consumer should set the socket member of this handle.
40 // 41 //
41 // This method returns ERR_IO_PENDING if it cannot complete synchronously, in 42 // This method returns ERR_IO_PENDING if it cannot complete synchronously, in
42 // which case the consumer should wait for the completion callback to run. 43 // which case the consumer should wait for the completion callback to run.
43 // 44 //
44 // Init may be called multiple times. 45 // Init may be called multiple times.
45 // 46 //
46 int Init(const std::string& group_name, CompletionCallback* callback); 47 int Init(const std::string& group_name,
48 int priority,
49 CompletionCallback* callback);
47 50
48 // An initialized handle can be reset, which causes it to return to the 51 // An initialized handle can be reset, which causes it to return to the
49 // un-initialized state. This releases the underlying socket, which in the 52 // un-initialized state. This releases the underlying socket, which in the
50 // case of a socket that still has an established connection, indicates that 53 // case of a socket that still has an established connection, indicates that
51 // the socket may be kept alive for use by a subsequent ClientSocketHandle. 54 // the socket may be kept alive for use by a subsequent ClientSocketHandle.
52 // 55 //
53 // NOTE: To prevent the socket from being kept alive, be sure to call its 56 // NOTE: To prevent the socket from being kept alive, be sure to call its
54 // Disconnect method. 57 // Disconnect method.
55 // 58 //
56 void Reset(); 59 void Reset();
(...skipping 12 matching lines...) Expand all
69 scoped_refptr<ClientSocketPool> pool_; 72 scoped_refptr<ClientSocketPool> pool_;
70 scoped_ptr<ClientSocket>* socket_; 73 scoped_ptr<ClientSocket>* socket_;
71 std::string group_name_; 74 std::string group_name_;
72 75
73 DISALLOW_COPY_AND_ASSIGN(ClientSocketHandle); 76 DISALLOW_COPY_AND_ASSIGN(ClientSocketHandle);
74 }; 77 };
75 78
76 } // namespace net 79 } // namespace net
77 80
78 #endif // NET_BASE_CLIENT_SOCKET_HANDLE_H_ 81 #endif // NET_BASE_CLIENT_SOCKET_HANDLE_H_
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/resource_dispatcher_host.cc ('k') | net/base/client_socket_handle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698