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

Side by Side Diff: ppapi/shared_impl/private/tcp_socket_private_impl.h

Issue 12220050: Provide a way to disable Nagle's algorithm on Pepper TCP sockets. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add missing completion callback implementation. Created 7 years, 10 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) 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 PPAPI_SHARED_IMPL_PRIVATE_TCP_SOCKET_PRIVATE_IMPL_H_ 5 #ifndef PPAPI_SHARED_IMPL_PRIVATE_TCP_SOCKET_PRIVATE_IMPL_H_
6 #define PPAPI_SHARED_IMPL_PRIVATE_TCP_SOCKET_PRIVATE_IMPL_H_ 6 #define PPAPI_SHARED_IMPL_PRIVATE_TCP_SOCKET_PRIVATE_IMPL_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 virtual PP_Resource GetServerCertificate() OVERRIDE; 59 virtual PP_Resource GetServerCertificate() OVERRIDE;
60 virtual PP_Bool AddChainBuildingCertificate(PP_Resource certificate, 60 virtual PP_Bool AddChainBuildingCertificate(PP_Resource certificate,
61 PP_Bool trusted) OVERRIDE; 61 PP_Bool trusted) OVERRIDE;
62 virtual int32_t Read(char* buffer, 62 virtual int32_t Read(char* buffer,
63 int32_t bytes_to_read, 63 int32_t bytes_to_read,
64 scoped_refptr<TrackedCallback> callback) OVERRIDE; 64 scoped_refptr<TrackedCallback> callback) OVERRIDE;
65 virtual int32_t Write(const char* buffer, 65 virtual int32_t Write(const char* buffer,
66 int32_t bytes_to_write, 66 int32_t bytes_to_write,
67 scoped_refptr<TrackedCallback> callback) OVERRIDE; 67 scoped_refptr<TrackedCallback> callback) OVERRIDE;
68 virtual void Disconnect() OVERRIDE; 68 virtual void Disconnect() OVERRIDE;
69 virtual int32_t SetSocketFeature(PP_TCPSocketFeature_Private name,
yzshen1 2013/02/08 21:51:11 For function declarations and definitions, put eac
Wez 2013/02/10 04:47:02 Done.
70 struct PP_Var value, scoped_refptr<TrackedCallback> callback) OVERRIDE;
yzshen1 2013/02/08 21:51:11 you don't need to have 'struct' here.
Wez 2013/02/10 04:47:02 Done.
69 71
70 // Notifications on operations completion. 72 // Notifications on operations completion.
71 void OnConnectCompleted(bool succeeded, 73 void OnConnectCompleted(bool succeeded,
72 const PP_NetAddress_Private& local_addr, 74 const PP_NetAddress_Private& local_addr,
73 const PP_NetAddress_Private& remote_addr); 75 const PP_NetAddress_Private& remote_addr);
74 void OnSSLHandshakeCompleted( 76 void OnSSLHandshakeCompleted(
75 bool succeeded, 77 bool succeeded,
76 const PPB_X509Certificate_Fields& certificate_fields); 78 const PPB_X509Certificate_Fields& certificate_fields);
77 void OnReadCompleted(bool succeeded, const std::string& data); 79 void OnReadCompleted(bool succeeded, const std::string& data);
78 void OnWriteCompleted(bool succeeded, int32_t bytes_written); 80 void OnWriteCompleted(bool succeeded, int32_t bytes_written);
81 void OnSetSocketFeatureCompleted(bool succeeded);
79 82
80 // Send functions that need to be implemented differently for the 83 // Send functions that need to be implemented differently for the
81 // proxied and non-proxied derived classes. 84 // proxied and non-proxied derived classes.
82 virtual void SendConnect(const std::string& host, uint16_t port) = 0; 85 virtual void SendConnect(const std::string& host, uint16_t port) = 0;
83 virtual void SendConnectWithNetAddress(const PP_NetAddress_Private& addr) = 0; 86 virtual void SendConnectWithNetAddress(const PP_NetAddress_Private& addr) = 0;
84 virtual void SendSSLHandshake( 87 virtual void SendSSLHandshake(
85 const std::string& server_name, 88 const std::string& server_name,
86 uint16_t server_port, 89 uint16_t server_port,
87 const std::vector<std::vector<char> >& trusted_certs, 90 const std::vector<std::vector<char> >& trusted_certs,
88 const std::vector<std::vector<char> >& untrusted_certs) = 0; 91 const std::vector<std::vector<char> >& untrusted_certs) = 0;
89 virtual void SendRead(int32_t bytes_to_read) = 0; 92 virtual void SendRead(int32_t bytes_to_read) = 0;
90 virtual void SendWrite(const std::string& buffer) = 0; 93 virtual void SendWrite(const std::string& buffer) = 0;
91 virtual void SendDisconnect() = 0; 94 virtual void SendDisconnect() = 0;
95 virtual void SendBoolSocketFeature(int32_t name, bool value) = 0;
92 96
93 protected: 97 protected:
94 enum ConnectionState { 98 enum ConnectionState {
95 // Before a connection is successfully established (including a connect 99 // Before a connection is successfully established (including a connect
96 // request is pending or a previous connect request failed). 100 // request is pending or a previous connect request failed).
97 BEFORE_CONNECT, 101 BEFORE_CONNECT,
98 // A connection has been successfully established (including a request of 102 // A connection has been successfully established (including a request of
99 // initiating SSL is pending). 103 // initiating SSL is pending).
100 CONNECTED, 104 CONNECTED,
101 // An SSL connection has been successfully established. 105 // An SSL connection has been successfully established.
102 SSL_CONNECTED, 106 SSL_CONNECTED,
103 // The connection has been ended. 107 // The connection has been ended.
104 DISCONNECTED 108 DISCONNECTED
105 }; 109 };
106 110
107 void Init(uint32 socket_id); 111 void Init(uint32 socket_id);
108 bool IsConnected() const; 112 bool IsConnected() const;
109 void PostAbortIfNecessary(scoped_refptr<TrackedCallback>* callback); 113 void PostAbortIfNecessary(scoped_refptr<TrackedCallback>* callback);
110 114
111 ResourceObjectType resource_type_; 115 ResourceObjectType resource_type_;
112 116
113 uint32 socket_id_; 117 uint32 socket_id_;
114 ConnectionState connection_state_; 118 ConnectionState connection_state_;
115 119
116 scoped_refptr<TrackedCallback> connect_callback_; 120 scoped_refptr<TrackedCallback> connect_callback_;
117 scoped_refptr<TrackedCallback> ssl_handshake_callback_; 121 scoped_refptr<TrackedCallback> ssl_handshake_callback_;
118 scoped_refptr<TrackedCallback> read_callback_; 122 scoped_refptr<TrackedCallback> read_callback_;
119 scoped_refptr<TrackedCallback> write_callback_; 123 scoped_refptr<TrackedCallback> write_callback_;
124 scoped_refptr<TrackedCallback> set_feature_callback_;
120 125
121 char* read_buffer_; 126 char* read_buffer_;
122 int32_t bytes_to_read_; 127 int32_t bytes_to_read_;
123 128
124 PP_NetAddress_Private local_addr_; 129 PP_NetAddress_Private local_addr_;
125 PP_NetAddress_Private remote_addr_; 130 PP_NetAddress_Private remote_addr_;
126 131
127 scoped_refptr<PPB_X509Certificate_Private_Shared> server_certificate_; 132 scoped_refptr<PPB_X509Certificate_Private_Shared> server_certificate_;
128 133
129 std::vector<std::vector<char> > trusted_certificates_; 134 std::vector<std::vector<char> > trusted_certificates_;
130 std::vector<std::vector<char> > untrusted_certificates_; 135 std::vector<std::vector<char> > untrusted_certificates_;
131 136
132 DISALLOW_COPY_AND_ASSIGN(TCPSocketPrivateImpl); 137 DISALLOW_COPY_AND_ASSIGN(TCPSocketPrivateImpl);
133 }; 138 };
134 139
135 } // namespace ppapi 140 } // namespace ppapi
136 141
137 #endif // PPAPI_SHARED_IMPL_PRIVATE_TCP_SOCKET_PRIVATE_IMPL_H_ 142 #endif // PPAPI_SHARED_IMPL_PRIVATE_TCP_SOCKET_PRIVATE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698