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

Side by Side Diff: net/quic/chromium/bidirectional_stream_quic_impl.cc

Issue 2740453006: Add QuicStringPiece which is actually StringPiece. (Closed)
Patch Set: fix compile error and rebase Created 3 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
« no previous file with comments | « net/BUILD.gn ('k') | net/quic/chromium/bidirectional_stream_quic_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "net/quic/chromium/bidirectional_stream_quic_impl.h" 5 #include "net/quic/chromium/bidirectional_stream_quic_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/threading/thread_task_runner_handle.h" 12 #include "base/threading/thread_task_runner_handle.h"
13 #include "base/timer/timer.h" 13 #include "base/timer/timer.h"
14 #include "net/http/bidirectional_stream_request_info.h" 14 #include "net/http/bidirectional_stream_request_info.h"
15 #include "net/quic/core/quic_connection.h" 15 #include "net/quic/core/quic_connection.h"
16 #include "net/quic/platform/api/quic_string_piece.h"
16 #include "net/socket/next_proto.h" 17 #include "net/socket/next_proto.h"
17 #include "net/spdy/spdy_header_block.h" 18 #include "net/spdy/spdy_header_block.h"
18 #include "net/spdy/spdy_http_utils.h" 19 #include "net/spdy/spdy_http_utils.h"
19 20
20 namespace net { 21 namespace net {
21 22
22 BidirectionalStreamQuicImpl::BidirectionalStreamQuicImpl( 23 BidirectionalStreamQuicImpl::BidirectionalStreamQuicImpl(
23 const base::WeakPtr<QuicChromiumClientSession>& session) 24 const base::WeakPtr<QuicChromiumClientSession>& session)
24 : session_(session), 25 : session_(session),
25 was_handshake_confirmed_(session->IsCryptoHandshakeConfirmed()), 26 was_handshake_confirmed_(session->IsCryptoHandshakeConfirmed()),
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 std::unique_ptr<QuicConnection::ScopedPacketBundler> bundler; 148 std::unique_ptr<QuicConnection::ScopedPacketBundler> bundler;
148 if (!has_sent_headers_) { 149 if (!has_sent_headers_) {
149 DCHECK(!send_request_headers_automatically_); 150 DCHECK(!send_request_headers_automatically_);
150 // Creates a bundler only if there are headers to be sent along with the 151 // Creates a bundler only if there are headers to be sent along with the
151 // single data buffer. 152 // single data buffer.
152 bundler.reset(new QuicConnection::ScopedPacketBundler( 153 bundler.reset(new QuicConnection::ScopedPacketBundler(
153 session_->connection(), QuicConnection::SEND_ACK_IF_PENDING)); 154 session_->connection(), QuicConnection::SEND_ACK_IF_PENDING));
154 SendRequestHeaders(); 155 SendRequestHeaders();
155 } 156 }
156 157
157 base::StringPiece string_data(data->data(), length); 158 QuicStringPiece string_data(data->data(), length);
158 int rv = stream_->WriteStreamData( 159 int rv = stream_->WriteStreamData(
159 string_data, end_stream, 160 string_data, end_stream,
160 base::Bind(&BidirectionalStreamQuicImpl::OnSendDataComplete, 161 base::Bind(&BidirectionalStreamQuicImpl::OnSendDataComplete,
161 weak_factory_.GetWeakPtr())); 162 weak_factory_.GetWeakPtr()));
162 DCHECK(rv == OK || rv == ERR_IO_PENDING); 163 DCHECK(rv == OK || rv == ERR_IO_PENDING);
163 if (rv == OK) { 164 if (rv == OK) {
164 base::ThreadTaskRunnerHandle::Get()->PostTask( 165 base::ThreadTaskRunnerHandle::Get()->PostTask(
165 FROM_HERE, base::Bind(&BidirectionalStreamQuicImpl::OnSendDataComplete, 166 FROM_HERE, base::Bind(&BidirectionalStreamQuicImpl::OnSendDataComplete,
166 weak_factory_.GetWeakPtr(), OK)); 167 weak_factory_.GetWeakPtr(), OK));
167 } 168 }
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 if (!stream_) 355 if (!stream_)
355 return; 356 return;
356 closed_stream_received_bytes_ = stream_->stream_bytes_read(); 357 closed_stream_received_bytes_ = stream_->stream_bytes_read();
357 closed_stream_sent_bytes_ = stream_->stream_bytes_written(); 358 closed_stream_sent_bytes_ = stream_->stream_bytes_written();
358 closed_is_first_stream_ = stream_->IsFirstStream(); 359 closed_is_first_stream_ = stream_->IsFirstStream();
359 stream_->SetDelegate(nullptr); 360 stream_->SetDelegate(nullptr);
360 stream_ = nullptr; 361 stream_ = nullptr;
361 } 362 }
362 363
363 } // namespace net 364 } // namespace net
OLDNEW
« no previous file with comments | « net/BUILD.gn ('k') | net/quic/chromium/bidirectional_stream_quic_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698