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

Side by Side Diff: net/spdy/bidirectional_stream_spdy_impl.h

Issue 2783683002: Log source_dependency in HTTP2_SESSION_SEND_HEADERS. (Closed)
Patch Set: Fix use-after-free. Created 3 years, 8 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_SPDY_BIDIRECTIONAL_STREAM_SPDY_IMPL_H_ 5 #ifndef NET_SPDY_BIDIRECTIONAL_STREAM_SPDY_IMPL_H_
6 #define NET_SPDY_BIDIRECTIONAL_STREAM_SPDY_IMPL_H_ 6 #define NET_SPDY_BIDIRECTIONAL_STREAM_SPDY_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "net/base/load_timing_info.h" 16 #include "net/base/load_timing_info.h"
17 #include "net/base/net_export.h" 17 #include "net/base/net_export.h"
18 #include "net/http/bidirectional_stream_impl.h" 18 #include "net/http/bidirectional_stream_impl.h"
19 #include "net/http/bidirectional_stream_request_info.h" 19 #include "net/http/bidirectional_stream_request_info.h"
20 #include "net/http/http_request_info.h" 20 #include "net/http/http_request_info.h"
21 #include "net/log/net_log_source.h"
21 #include "net/spdy/spdy_read_queue.h" 22 #include "net/spdy/spdy_read_queue.h"
22 #include "net/spdy/spdy_session.h" 23 #include "net/spdy/spdy_session.h"
23 #include "net/spdy/spdy_stream.h" 24 #include "net/spdy/spdy_stream.h"
24 25
25 namespace base { 26 namespace base {
26 class Timer; 27 class Timer;
27 } // namespace base 28 } // namespace base
28 29
29 namespace net { 30 namespace net {
30 31
31 class IOBuffer; 32 class IOBuffer;
32 class NetLogWithSource; 33 class NetLogWithSource;
33 class SpdyHeaderBlock; 34 class SpdyHeaderBlock;
34 35
35 class NET_EXPORT_PRIVATE BidirectionalStreamSpdyImpl 36 class NET_EXPORT_PRIVATE BidirectionalStreamSpdyImpl
36 : public BidirectionalStreamImpl, 37 : public BidirectionalStreamImpl,
37 public SpdyStream::Delegate { 38 public SpdyStream::Delegate {
38 public: 39 public:
39 explicit BidirectionalStreamSpdyImpl( 40 BidirectionalStreamSpdyImpl(const base::WeakPtr<SpdySession>& spdy_session,
40 const base::WeakPtr<SpdySession>& spdy_session); 41 NetLogSource source_dependency);
41 42
42 ~BidirectionalStreamSpdyImpl() override; 43 ~BidirectionalStreamSpdyImpl() override;
43 44
44 // BidirectionalStreamImpl implementation: 45 // BidirectionalStreamImpl implementation:
45 void Start(const BidirectionalStreamRequestInfo* request_info, 46 void Start(const BidirectionalStreamRequestInfo* request_info,
46 const NetLogWithSource& net_log, 47 const NetLogWithSource& net_log,
47 bool send_request_headers_automatically, 48 bool send_request_headers_automatically,
48 BidirectionalStreamImpl::Delegate* delegate, 49 BidirectionalStreamImpl::Delegate* delegate,
49 std::unique_ptr<base::Timer> timer) override; 50 std::unique_ptr<base::Timer> timer) override;
50 void SendRequestHeaders() override; 51 void SendRequestHeaders() override;
51 int ReadData(IOBuffer* buf, int buf_len) override; 52 int ReadData(IOBuffer* buf, int buf_len) override;
52 void SendData(const scoped_refptr<IOBuffer>& data, 53 void SendData(const scoped_refptr<IOBuffer>& data,
53 int length, 54 int length,
54 bool end_stream) override; 55 bool end_stream) override;
55 void SendvData(const std::vector<scoped_refptr<IOBuffer>>& buffers, 56 void SendvData(const std::vector<scoped_refptr<IOBuffer>>& buffers,
56 const std::vector<int>& lengths, 57 const std::vector<int>& lengths,
57 bool end_stream) override; 58 bool end_stream) override;
58 NextProto GetProtocol() const override; 59 NextProto GetProtocol() const override;
59 int64_t GetTotalReceivedBytes() const override; 60 int64_t GetTotalReceivedBytes() const override;
60 int64_t GetTotalSentBytes() const override; 61 int64_t GetTotalSentBytes() const override;
61 bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const override; 62 bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const override;
62 63
63 // SpdyStream::Delegate implementation: 64 // SpdyStream::Delegate implementation:
64 void OnHeadersSent() override; 65 void OnHeadersSent() override;
65 void OnHeadersReceived(const SpdyHeaderBlock& response_headers) override; 66 void OnHeadersReceived(const SpdyHeaderBlock& response_headers) override;
66 void OnDataReceived(std::unique_ptr<SpdyBuffer> buffer) override; 67 void OnDataReceived(std::unique_ptr<SpdyBuffer> buffer) override;
67 void OnDataSent() override; 68 void OnDataSent() override;
68 void OnTrailers(const SpdyHeaderBlock& trailers) override; 69 void OnTrailers(const SpdyHeaderBlock& trailers) override;
69 void OnClose(int status) override; 70 void OnClose(int status) override;
71 NetLogSource source_dependency() const override;
70 72
71 private: 73 private:
72 int SendRequestHeadersHelper(); 74 int SendRequestHeadersHelper();
73 void OnStreamInitialized(int rv); 75 void OnStreamInitialized(int rv);
74 // Notifies delegate of an error. 76 // Notifies delegate of an error.
75 void NotifyError(int rv); 77 void NotifyError(int rv);
76 void ResetStream(); 78 void ResetStream();
77 void ScheduleBufferedRead(); 79 void ScheduleBufferedRead();
78 void DoBufferedRead(); 80 void DoBufferedRead();
79 bool ShouldWaitForMoreBufferedData() const; 81 bool ShouldWaitForMoreBufferedData() const;
80 // Handles the case where stream is closed when SendData()/SendvData() is 82 // Handles the case where stream is closed when SendData()/SendvData() is
81 // called. Return true if stream is closed. 83 // called. Return true if stream is closed.
82 bool MaybeHandleStreamClosedInSendData(); 84 bool MaybeHandleStreamClosedInSendData();
83 85
84 const base::WeakPtr<SpdySession> spdy_session_; 86 const base::WeakPtr<SpdySession> spdy_session_;
85 const BidirectionalStreamRequestInfo* request_info_; 87 const BidirectionalStreamRequestInfo* request_info_;
86 BidirectionalStreamImpl::Delegate* delegate_; 88 BidirectionalStreamImpl::Delegate* delegate_;
87 std::unique_ptr<base::Timer> timer_; 89 std::unique_ptr<base::Timer> timer_;
88 SpdyStreamRequest stream_request_; 90 SpdyStreamRequest stream_request_;
89 base::WeakPtr<SpdyStream> stream_; 91 base::WeakPtr<SpdyStream> stream_;
92 const NetLogSource source_dependency_;
90 93
91 NextProto negotiated_protocol_; 94 NextProto negotiated_protocol_;
92 95
93 // Buffers the data as it arrives asynchronously from the stream. 96 // Buffers the data as it arrives asynchronously from the stream.
94 SpdyReadQueue read_data_queue_; 97 SpdyReadQueue read_data_queue_;
95 // Whether received more data has arrived since started waiting. 98 // Whether received more data has arrived since started waiting.
96 bool more_read_data_pending_; 99 bool more_read_data_pending_;
97 // User provided read buffer for ReadData() response. 100 // User provided read buffer for ReadData() response.
98 scoped_refptr<IOBuffer> read_buffer_; 101 scoped_refptr<IOBuffer> read_buffer_;
99 int read_buffer_len_; 102 int read_buffer_len_;
(...skipping 24 matching lines...) Expand all
124 scoped_refptr<IOBuffer> pending_combined_buffer_; 127 scoped_refptr<IOBuffer> pending_combined_buffer_;
125 128
126 base::WeakPtrFactory<BidirectionalStreamSpdyImpl> weak_factory_; 129 base::WeakPtrFactory<BidirectionalStreamSpdyImpl> weak_factory_;
127 130
128 DISALLOW_COPY_AND_ASSIGN(BidirectionalStreamSpdyImpl); 131 DISALLOW_COPY_AND_ASSIGN(BidirectionalStreamSpdyImpl);
129 }; 132 };
130 133
131 } // namespace net 134 } // namespace net
132 135
133 #endif // NET_SPDY_BIDIRECTIONAL_STREAM_SPDY_IMPL_H_ 136 #endif // NET_SPDY_BIDIRECTIONAL_STREAM_SPDY_IMPL_H_
OLDNEW
« no previous file with comments | « net/http/http_stream_factory_impl_job_controller.cc ('k') | net/spdy/bidirectional_stream_spdy_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698