Commit 0de18b2b authored by Ryan Hamilton's avatar Ryan Hamilton Committed by Commit Bot

Clean up files in QUIC's platform/api/ directory to remove code divergence with chromium.

Change-Id: I852ca097fcb27b88e8e3473c79b87ae455222ad3
Reviewed-on: https://chromium-review.googlesource.com/1111573
Commit-Queue: Ryan Hamilton <rch@chromium.org>
Reviewed-by: default avatarZhongyi Shi <zhongyi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#569646}
parent 92958ccd
...@@ -1493,11 +1493,9 @@ component("net") { ...@@ -1493,11 +1493,9 @@ component("net") {
"third_party/quic/platform/api/quic_mem_slice_span.h", "third_party/quic/platform/api/quic_mem_slice_span.h",
"third_party/quic/platform/api/quic_mutex.cc", "third_party/quic/platform/api/quic_mutex.cc",
"third_party/quic/platform/api/quic_mutex.h", "third_party/quic/platform/api/quic_mutex.h",
"third_party/quic/platform/api/quic_optional.h",
"third_party/quic/platform/api/quic_pcc_sender.h", "third_party/quic/platform/api/quic_pcc_sender.h",
"third_party/quic/platform/api/quic_prefetch.h", "third_party/quic/platform/api/quic_prefetch.h",
"third_party/quic/platform/api/quic_ptr_util.h", "third_party/quic/platform/api/quic_ptr_util.h",
"third_party/quic/platform/api/quic_reconstruct_object.h",
"third_party/quic/platform/api/quic_reference_counted.h", "third_party/quic/platform/api/quic_reference_counted.h",
"third_party/quic/platform/api/quic_singleton.h", "third_party/quic/platform/api/quic_singleton.h",
"third_party/quic/platform/api/quic_sleep.h", "third_party/quic/platform/api/quic_sleep.h",
...@@ -1540,11 +1538,9 @@ component("net") { ...@@ -1540,11 +1538,9 @@ component("net") {
"third_party/quic/platform/impl/quic_mem_slice_span_impl.h", "third_party/quic/platform/impl/quic_mem_slice_span_impl.h",
"third_party/quic/platform/impl/quic_mutex_impl.cc", "third_party/quic/platform/impl/quic_mutex_impl.cc",
"third_party/quic/platform/impl/quic_mutex_impl.h", "third_party/quic/platform/impl/quic_mutex_impl.h",
"third_party/quic/platform/impl/quic_optional_impl.h",
"third_party/quic/platform/impl/quic_pcc_sender_impl.h", "third_party/quic/platform/impl/quic_pcc_sender_impl.h",
"third_party/quic/platform/impl/quic_prefetch_impl.h", "third_party/quic/platform/impl/quic_prefetch_impl.h",
"third_party/quic/platform/impl/quic_ptr_util_impl.h", "third_party/quic/platform/impl/quic_ptr_util_impl.h",
"third_party/quic/platform/impl/quic_reconstruct_object_impl.h",
"third_party/quic/platform/impl/quic_reference_counted_impl.h", "third_party/quic/platform/impl/quic_reference_counted_impl.h",
"third_party/quic/platform/impl/quic_singleton_impl.h", "third_party/quic/platform/impl/quic_singleton_impl.h",
"third_party/quic/platform/impl/quic_sleep_impl.h", "third_party/quic/platform/impl/quic_sleep_impl.h",
......
// Copyright (c) 2016 The Chromium Authors. All rights reserved. // Copyright (c) 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef NET_THIRD_PARTY_QUIC_PLATFORM_API_QUIC_BUG_TRACKER_H_ #ifndef NET_THIRD_PARTY_QUIC_PLATFORM_API_QUIC_BUG_TRACKER_H_
#define NET_THIRD_PARTY_QUIC_PLATFORM_API_QUIC_BUG_TRACKER_H_ #define NET_THIRD_PARTY_QUIC_PLATFORM_API_QUIC_BUG_TRACKER_H_
...@@ -11,4 +12,4 @@ ...@@ -11,4 +12,4 @@
#define QUIC_PEER_BUG QUIC_PEER_BUG_IMPL #define QUIC_PEER_BUG QUIC_PEER_BUG_IMPL
#define QUIC_PEER_BUG_IF QUIC_PEER_BUG_IF_IMPL #define QUIC_PEER_BUG_IF QUIC_PEER_BUG_IF_IMPL
#endif // NET_THIRD_PARTY_QUIC_PLATFORM_API_QUIC_BUG_TRACKER_H_ #endif // NET_THIRD_PARTY_QUIC_PLATFORM_API_QUIC_BUG_TRACKER_H_
\ No newline at end of file
// Copyright (c) 2018 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 NET_THIRD_PARTY_QUIC_PLATFORM_API_QUIC_FILE_UTILS_H_ #ifndef NET_THIRD_PARTY_QUIC_PLATFORM_API_QUIC_FILE_UTILS_H_
#define NET_THIRD_PARTY_QUIC_PLATFORM_API_QUIC_FILE_UTILS_H_ #define NET_THIRD_PARTY_QUIC_PLATFORM_API_QUIC_FILE_UTILS_H_
......
...@@ -30,28 +30,36 @@ TEST_F(QuicHostnameUtilsTest, IsValidSNI) { ...@@ -30,28 +30,36 @@ TEST_F(QuicHostnameUtilsTest, IsValidSNI) {
} }
TEST_F(QuicHostnameUtilsTest, NormalizeHostname) { TEST_F(QuicHostnameUtilsTest, NormalizeHostname) {
// clang-format off
struct { struct {
const char *input, *expected; const char *input, *expected;
} tests[] = { } tests[] = {
{ {
"www.google.com", "www.google.com", "www.google.com",
"www.google.com",
}, },
{ {
"WWW.GOOGLE.COM", "www.google.com", "WWW.GOOGLE.COM",
"www.google.com",
}, },
{ {
"www.google.com.", "www.google.com", "www.google.com.",
"www.google.com",
}, },
{ {
"www.google.COM.", "www.google.com", "www.google.COM.",
"www.google.com",
}, },
{ {
"www.google.com..", "www.google.com", "www.google.com..",
"www.google.com",
}, },
{ {
"www.google.com........", "www.google.com", "www.google.com........",
"www.google.com",
}, },
}; };
// clang-format on
for (size_t i = 0; i < QUIC_ARRAYSIZE(tests); ++i) { for (size_t i = 0; i < QUIC_ARRAYSIZE(tests); ++i) {
char buf[256]; char buf[256];
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#define QUIC_PREDICT_FALSE(x) QUIC_PREDICT_FALSE_IMPL(x) #define QUIC_PREDICT_FALSE(x) QUIC_PREDICT_FALSE_IMPL(x)
// This is a noop in release build.
#define QUIC_NOTREACHED() QUIC_NOTREACHED_IMPL() #define QUIC_NOTREACHED() QUIC_NOTREACHED_IMPL()
#define QUIC_PLOG(severity) QUIC_PLOG_IMPL(severity) #define QUIC_PLOG(severity) QUIC_PLOG_IMPL(severity)
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#ifndef NET_THIRD_PARTY_QUIC_PLATFORM_API_QUIC_MEM_SLICE_H_ #ifndef NET_THIRD_PARTY_QUIC_PLATFORM_API_QUIC_MEM_SLICE_H_
#define NET_THIRD_PARTY_QUIC_PLATFORM_API_QUIC_MEM_SLICE_H_ #define NET_THIRD_PARTY_QUIC_PLATFORM_API_QUIC_MEM_SLICE_H_
#include "net/third_party/quic/platform/api/quic_export.h"
#include "net/third_party/quic/platform/impl/quic_mem_slice_impl.h" #include "net/third_party/quic/platform/impl/quic_mem_slice_impl.h"
namespace quic { namespace quic {
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#ifndef NET_THIRD_PARTY_QUIC_PLATFORM_API_QUIC_MEM_SLICE_SPAN_H_ #ifndef NET_THIRD_PARTY_QUIC_PLATFORM_API_QUIC_MEM_SLICE_SPAN_H_
#define NET_THIRD_PARTY_QUIC_PLATFORM_API_QUIC_MEM_SLICE_SPAN_H_ #define NET_THIRD_PARTY_QUIC_PLATFORM_API_QUIC_MEM_SLICE_SPAN_H_
#include "net/third_party/quic/platform/api/quic_export.h"
#include "net/third_party/quic/platform/impl/quic_mem_slice_span_impl.h" #include "net/third_party/quic/platform/impl/quic_mem_slice_span_impl.h"
namespace quic { namespace quic {
......
// 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 NET_THIRD_PARTY_QUIC_PLATFORM_API_QUIC_OPTIONAL_H_
#define NET_THIRD_PARTY_QUIC_PLATFORM_API_QUIC_OPTIONAL_H_
#include "net/third_party/quic/platform/impl/quic_optional_impl.h"
namespace quic {
template <typename T>
using QuicOptional = QuicOptionalImpl<T>;
} // namespace quic
#endif // NET_THIRD_PARTY_QUIC_PLATFORM_API_QUIC_OPTIONAL_H_
// Copyright (c) 2017 The Chromium Authors. All rights reserved. // Copyright (c) 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef NET_THIRD_PARTY_QUIC_PLATFORM_API_QUIC_PTR_UTIL_H_ #ifndef NET_THIRD_PARTY_QUIC_PLATFORM_API_QUIC_PTR_UTIL_H_
#define NET_THIRD_PARTY_QUIC_PLATFORM_API_QUIC_PTR_UTIL_H_ #define NET_THIRD_PARTY_QUIC_PLATFORM_API_QUIC_PTR_UTIL_H_
......
// 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 NET_THIRD_PARTY_QUIC_PLATFORM_API_QUIC_RECONSTRUCT_OBJECT_H_
#define NET_THIRD_PARTY_QUIC_PLATFORM_API_QUIC_RECONSTRUCT_OBJECT_H_
#include <utility>
#include "net/third_party/quic/platform/impl/quic_reconstruct_object_impl.h"
namespace quic {
namespace test {
// Reconstruct an object so that it is initialized as when it was first
// constructed. Runs the destructor to handle objects that might own resources,
// and runs the constructor with the provided arguments, if any.
template <class T, class... Args>
void QuicReconstructObject(T* ptr, QuicTestRandomBase* rng, Args&&... args) {
QuicReconstructObjectImpl(ptr, rng, std::forward<Args>(args)...);
}
// This version applies default-initialization to the object.
template <class T>
void QuicDefaultReconstructObject(T* ptr, QuicTestRandomBase* rng) {
QuicDefaultReconstructObjectImpl(ptr, rng);
}
} // namespace test
} // namespace quic
#endif // NET_THIRD_PARTY_QUIC_PLATFORM_API_QUIC_RECONSTRUCT_OBJECT_H_
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
namespace quic { namespace quic {
// Merges given strings or numbers with no delimiter.
template <typename... Args> template <typename... Args>
inline QuicString QuicStrCat(const Args&... args) { inline QuicString QuicStrCat(const Args&... args) {
return QuicStrCatImpl(std::forward<const Args&>(args)...); return QuicStrCatImpl(std::forward<const Args&>(args)...);
......
...@@ -14,9 +14,6 @@ ...@@ -14,9 +14,6 @@
namespace quic { namespace quic {
namespace test { namespace test {
using QuicTestRandomBase = QuicTestRandomBaseImpl;
// QuicTestRandomImpl must inherit from QuicTestRandomBaseImpl;
using QuicTestRandom = QuicTestRandomImpl; using QuicTestRandom = QuicTestRandomImpl;
} // namespace test } // namespace test
......
// 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 NET_THIRD_PARTY_QUIC_PLATFORM_IMPL_QUIC_OPTIONAL_IMPL_H_
#define NET_THIRD_PARTY_QUIC_PLATFORM_IMPL_QUIC_OPTIONAL_IMPL_H_
#include "base/optional.h"
namespace quic {
template <typename T>
using QuicOptionalImpl = base::Optional<T>;
} // namespace quic
#endif // NET_THIRD_PARTY_QUIC_PLATFORM_IMPL_QUIC_OPTIONAL_IMPL_H_
// 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 NET_THIRD_PARTY_QUIC_PLATFORM_IMPL_QUIC_RECONSTRUCT_OBJECT_IMPL_H_
#define NET_THIRD_PARTY_QUIC_PLATFORM_IMPL_QUIC_RECONSTRUCT_OBJECT_IMPL_H_
// Support for marking memory as uninitialized, or otherwise corrupting it. Used
// in testing in an attempt to ensure that there isn't "leakage" of state from
// one sub-test to another. For example, in tests based on RandomDecoderTest,
// the same objects (decoder or decoder destination), will be used multiple
// times as a single encoded input is repeatedly decoded with multiple
// segmentations of the input.
//
// If compiled with Memory Sanitizer, the memory is marked as uninitialized;
// else the memory is overwritten with random bytes.
#include <stddef.h>
#include <algorithm>
#include <new>
#include <utility>
namespace quic {
namespace test {
// Reconstruct an object so that it is initialized as when it was first
// constructed. Runs the destructor to handle objects that might own resources,
// marks the object's memory as as uninitialized, and finally runs the
// constructor with the provided arguments, if any.
template <class T, class... Args>
void QuicReconstructObjectImpl(T* ptr,
QuicTestRandomBase* rng,
Args&&... args) {
ptr->~T();
::new (ptr) T(std::forward<Args>(args)...);
}
// This version applies default-initialization to the object.
template <class T>
void QuicDefaultReconstructObjectImpl(T* ptr, QuicTestRandomBase* rng) {
ptr->~T();
::new (ptr) T;
}
} // namespace test
} // namespace quic
#endif // NET_THIRD_PARTY_QUIC_PLATFORM_IMPL_QUIC_RECONSTRUCT_OBJECT_IMPL_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment