Remove unused SpdyMemSlice. PiperOrigin-RevId: 365079745 Change-Id: I7220223e621fe227cd1ddd13f60b550219b282b6
diff --git a/spdy/platform/api/spdy_mem_slice.h b/spdy/platform/api/spdy_mem_slice.h deleted file mode 100644 index 8288f33..0000000 --- a/spdy/platform/api/spdy_mem_slice.h +++ /dev/null
@@ -1,54 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef QUICHE_SPDY_PLATFORM_API_SPDY_MEM_SLICE_H_ -#define QUICHE_SPDY_PLATFORM_API_SPDY_MEM_SLICE_H_ - -#include <utility> - -#include "common/platform/api/quiche_export.h" -#include "net/spdy/platform/impl/spdy_mem_slice_impl.h" - -namespace spdy { - -// SpdyMemSlice is an internally reference counted data buffer used as the -// source buffers for write operations. SpdyMemSlice implicitly maintains a -// reference count and will free the underlying data buffer when the reference -// count reaches zero. -class QUICHE_EXPORT_PRIVATE SpdyMemSlice { - public: - // Constructs an empty SpdyMemSlice with no underlying data and 0 reference - // count. - SpdyMemSlice() = default; - - // Constructs a SpdyMemSlice with reference count 1 to a newly allocated data - // buffer of |length| bytes. - explicit SpdyMemSlice(size_t length) : impl_(length) {} - - // Constructs a SpdyMemSlice from |impl|. It takes the reference away from - // |impl|. - explicit SpdyMemSlice(SpdyMemSliceImpl impl) : impl_(std::move(impl)) {} - - SpdyMemSlice(const SpdyMemSlice& other) = delete; - SpdyMemSlice& operator=(const SpdyMemSlice& other) = delete; - - // Move constructors. |other| will not hold a reference to the data buffer - // after this call completes. - SpdyMemSlice(SpdyMemSlice&& other) = default; - SpdyMemSlice& operator=(SpdyMemSlice&& other) = default; - - ~SpdyMemSlice() = default; - - // Returns a char pointer to underlying data buffer. - const char* data() const { return impl_.data(); } - // Returns the length of underlying data buffer. - size_t length() const { return impl_.length(); } - - private: - SpdyMemSliceImpl impl_; -}; - -} // namespace spdy - -#endif // QUICHE_SPDY_PLATFORM_API_SPDY_MEM_SLICE_H_
diff --git a/spdy/platform/api/spdy_mem_slice_test.cc b/spdy/platform/api/spdy_mem_slice_test.cc deleted file mode 100644 index 0efb740..0000000 --- a/spdy/platform/api/spdy_mem_slice_test.cc +++ /dev/null
@@ -1,47 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "spdy/platform/api/spdy_mem_slice.h" - -#include <utility> - -#include "common/platform/api/quiche_test.h" - -namespace spdy { -namespace test { -namespace { - -class SpdyMemSliceTest : public QuicheTest { - public: - SpdyMemSliceTest() { - slice_ = SpdyMemSlice(1024); - orig_data_ = slice_.data(); - orig_length_ = slice_.length(); - } - - SpdyMemSlice slice_; - const char* orig_data_; - size_t orig_length_; -}; - -TEST_F(SpdyMemSliceTest, MoveConstruct) { - SpdyMemSlice moved(std::move(slice_)); - EXPECT_EQ(moved.data(), orig_data_); - EXPECT_EQ(moved.length(), orig_length_); - EXPECT_EQ(nullptr, slice_.data()); - EXPECT_EQ(0u, slice_.length()); -} - -TEST_F(SpdyMemSliceTest, MoveAssign) { - SpdyMemSlice moved; - moved = std::move(slice_); - EXPECT_EQ(moved.data(), orig_data_); - EXPECT_EQ(moved.length(), orig_length_); - EXPECT_EQ(nullptr, slice_.data()); - EXPECT_EQ(0u, slice_.length()); -} - -} // namespace -} // namespace test -} // namespace spdy
diff --git a/spdy/platform/api/spdy_string_utils.h b/spdy/platform/api/spdy_string_utils.h index f59bcd9..178415b 100644 --- a/spdy/platform/api/spdy_string_utils.h +++ b/spdy/platform/api/spdy_string_utils.h
@@ -8,12 +8,6 @@ #include <string> #include <utility> -// The following header file has to be included from at least -// non-test file in order to avoid strange linking errors. -// TODO(bnc): Remove this include as soon as it is included elsewhere in -// non-test code. -#include "spdy/platform/api/spdy_mem_slice.h" - #include "absl/strings/string_view.h" #include "net/spdy/platform/impl/spdy_string_utils_impl.h"