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

Side by Side Diff: net/spdy/buffered_spdy_framer_unittest.cc

Issue 2174943002: Avoid SpdyHeaderBlock copy in SpdyStream::OnPushPromiseHeadersReceived(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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/spdy/buffered_spdy_framer.cc ('k') | net/spdy/header_coalescer.h » ('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 (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 #include "net/spdy/buffered_spdy_framer.h" 5 #include "net/spdy/buffered_spdy_framer.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "net/spdy/spdy_test_util_common.h" 10 #include "net/spdy/spdy_test_util_common.h"
(...skipping 27 matching lines...) Expand all
38 << description; 38 << description;
39 error_count_++; 39 error_count_++;
40 } 40 }
41 41
42 void OnHeaders(SpdyStreamId stream_id, 42 void OnHeaders(SpdyStreamId stream_id,
43 bool has_priority, 43 bool has_priority,
44 int weight, 44 int weight,
45 SpdyStreamId parent_stream_id, 45 SpdyStreamId parent_stream_id,
46 bool exclusive, 46 bool exclusive,
47 bool fin, 47 bool fin,
48 const SpdyHeaderBlock& headers) override { 48 SpdyHeaderBlock headers) override {
49 header_stream_id_ = stream_id; 49 header_stream_id_ = stream_id;
50 EXPECT_NE(header_stream_id_, SpdyFramer::kInvalidStream); 50 EXPECT_NE(header_stream_id_, SpdyFramer::kInvalidStream);
51 headers_frame_count_++; 51 headers_frame_count_++;
52 headers_ = headers.Clone(); 52 headers_ = std::move(headers);
53 } 53 }
54 54
55 void OnDataFrameHeader(SpdyStreamId stream_id, 55 void OnDataFrameHeader(SpdyStreamId stream_id,
56 size_t length, 56 size_t length,
57 bool fin) override { 57 bool fin) override {
58 ADD_FAILURE() << "Unexpected OnDataFrameHeader call."; 58 ADD_FAILURE() << "Unexpected OnDataFrameHeader call.";
59 } 59 }
60 60
61 void OnStreamFrameData(SpdyStreamId stream_id, 61 void OnStreamFrameData(SpdyStreamId stream_id,
62 const char* data, 62 const char* data,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 LOG(FATAL) << "Unexpected OnDataFrameHeader call."; 96 LOG(FATAL) << "Unexpected OnDataFrameHeader call.";
97 } 97 }
98 98
99 void OnRstStream(const SpdySerializedFrame& frame) {} 99 void OnRstStream(const SpdySerializedFrame& frame) {}
100 void OnGoAway(const SpdySerializedFrame& frame) {} 100 void OnGoAway(const SpdySerializedFrame& frame) {}
101 void OnPing(const SpdySerializedFrame& frame) {} 101 void OnPing(const SpdySerializedFrame& frame) {}
102 void OnWindowUpdate(SpdyStreamId stream_id, int delta_window_size) override {} 102 void OnWindowUpdate(SpdyStreamId stream_id, int delta_window_size) override {}
103 103
104 void OnPushPromise(SpdyStreamId stream_id, 104 void OnPushPromise(SpdyStreamId stream_id,
105 SpdyStreamId promised_stream_id, 105 SpdyStreamId promised_stream_id,
106 const SpdyHeaderBlock& headers) override { 106 SpdyHeaderBlock headers) override {
107 header_stream_id_ = stream_id; 107 header_stream_id_ = stream_id;
108 EXPECT_NE(header_stream_id_, SpdyFramer::kInvalidStream); 108 EXPECT_NE(header_stream_id_, SpdyFramer::kInvalidStream);
109 push_promise_frame_count_++; 109 push_promise_frame_count_++;
110 promised_stream_id_ = promised_stream_id; 110 promised_stream_id_ = promised_stream_id;
111 EXPECT_NE(promised_stream_id_, SpdyFramer::kInvalidStream); 111 EXPECT_NE(promised_stream_id_, SpdyFramer::kInvalidStream);
112 headers_ = headers.Clone(); 112 headers_ = std::move(headers);
113 } 113 }
114 114
115 void OnAltSvc(SpdyStreamId stream_id, 115 void OnAltSvc(SpdyStreamId stream_id,
116 base::StringPiece origin, 116 base::StringPiece origin,
117 const SpdyAltSvcWireFormat::AlternativeServiceVector& 117 const SpdyAltSvcWireFormat::AlternativeServiceVector&
118 altsvc_vector) override { 118 altsvc_vector) override {
119 altsvc_count_++; 119 altsvc_count_++;
120 altsvc_stream_id_ = stream_id; 120 altsvc_stream_id_ = stream_id;
121 origin.CopyToString(&altsvc_origin_); 121 origin.CopyToString(&altsvc_origin_);
122 altsvc_vector_ = altsvc_vector; 122 altsvc_vector_ = altsvc_vector;
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 altsvc_frame.size()); 293 altsvc_frame.size());
294 EXPECT_EQ(0, visitor.error_count_); 294 EXPECT_EQ(0, visitor.error_count_);
295 EXPECT_EQ(1, visitor.altsvc_count_); 295 EXPECT_EQ(1, visitor.altsvc_count_);
296 EXPECT_EQ(altsvc_stream_id, visitor.altsvc_stream_id_); 296 EXPECT_EQ(altsvc_stream_id, visitor.altsvc_stream_id_);
297 EXPECT_EQ(altsvc_origin, visitor.altsvc_origin_); 297 EXPECT_EQ(altsvc_origin, visitor.altsvc_origin_);
298 ASSERT_EQ(1u, visitor.altsvc_vector_.size()); 298 ASSERT_EQ(1u, visitor.altsvc_vector_.size());
299 EXPECT_EQ(alternative_service, visitor.altsvc_vector_[0]); 299 EXPECT_EQ(alternative_service, visitor.altsvc_vector_[0]);
300 } 300 }
301 301
302 } // namespace net 302 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/buffered_spdy_framer.cc ('k') | net/spdy/header_coalescer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698