Remove deprecated variant of StreamInterface::WriteAll

This has been deprecated since November 2022.

Bug: None
Change-Id: Ia547489b1f703d0744ab7ffc096eeadbb937974a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/364381
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Auto-Submit: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43140}
This commit is contained in:
Harald Alvestrand 2024-10-02 10:28:59 +00:00 committed by WebRTC LUCI CQ
parent 09c043a4bb
commit d259a754a8
10 changed files with 67 additions and 32 deletions

View file

@ -971,14 +971,27 @@ if (rtc_include_tests) {
sources = [ "base/fake_ice_transport.h" ] sources = [ "base/fake_ice_transport.h" ]
deps = [ deps = [
":ice_transport_internal", ":ice_transport_internal",
":rtc_p2p",
":transport_description",
"../api:candidate",
"../api:ice_transport_interface", "../api:ice_transport_interface",
"../api:libjingle_peerconnection_api", "../api:libjingle_peerconnection_api",
"../api:sequence_checker",
"../api/task_queue:pending_task_safety_flag", "../api/task_queue:pending_task_safety_flag",
"../api/transport:enums",
"../api/units:time_delta", "../api/units:time_delta",
"../rtc_base:async_packet_socket",
"../rtc_base:checks",
"../rtc_base:copy_on_write_buffer", "../rtc_base:copy_on_write_buffer",
"../rtc_base:logging",
"../rtc_base:macromagic",
"../rtc_base:network_route",
"../rtc_base:socket",
"../rtc_base:task_queue_for_test", "../rtc_base:task_queue_for_test",
"../rtc_base:threading",
"../rtc_base:timeutils", "../rtc_base:timeutils",
"../rtc_base/network:received_packet", "../rtc_base/network:received_packet",
"../rtc_base/network:sent_packet",
"//third_party/abseil-cpp/absl/algorithm:container", "//third_party/abseil-cpp/absl/algorithm:container",
"//third_party/abseil-cpp/absl/strings:string_view", "//third_party/abseil-cpp/absl/strings:string_view",
] ]

View file

@ -11,6 +11,7 @@
#ifndef P2P_BASE_FAKE_ICE_TRANSPORT_H_ #ifndef P2P_BASE_FAKE_ICE_TRANSPORT_H_
#define P2P_BASE_FAKE_ICE_TRANSPORT_H_ #define P2P_BASE_FAKE_ICE_TRANSPORT_H_
#include <cstddef>
#include <map> #include <map>
#include <memory> #include <memory>
#include <optional> #include <optional>
@ -19,13 +20,29 @@
#include "absl/algorithm/container.h" #include "absl/algorithm/container.h"
#include "absl/strings/string_view.h" #include "absl/strings/string_view.h"
#include "api/candidate.h"
#include "api/ice_transport_interface.h" #include "api/ice_transport_interface.h"
#include "api/sequence_checker.h"
#include "api/task_queue/pending_task_safety_flag.h" #include "api/task_queue/pending_task_safety_flag.h"
#include "api/transport/enums.h"
#include "api/units/time_delta.h" #include "api/units/time_delta.h"
#include "p2p/base/candidate_pair_interface.h"
#include "p2p/base/connection.h"
#include "p2p/base/connection_info.h"
#include "p2p/base/ice_transport_internal.h" #include "p2p/base/ice_transport_internal.h"
#include "p2p/base/port.h"
#include "p2p/base/transport_description.h"
#include "rtc_base/async_packet_socket.h"
#include "rtc_base/checks.h"
#include "rtc_base/copy_on_write_buffer.h" #include "rtc_base/copy_on_write_buffer.h"
#include "rtc_base/logging.h"
#include "rtc_base/network/received_packet.h" #include "rtc_base/network/received_packet.h"
#include "rtc_base/network/sent_packet.h"
#include "rtc_base/network_route.h"
#include "rtc_base/socket.h"
#include "rtc_base/task_queue_for_test.h" #include "rtc_base/task_queue_for_test.h"
#include "rtc_base/thread.h"
#include "rtc_base/thread_annotations.h"
#include "rtc_base/time_utils.h" #include "rtc_base/time_utils.h"
namespace cricket { namespace cricket {

View file

@ -10,7 +10,13 @@
#include "p2p/base/turn_server.h" #include "p2p/base/turn_server.h"
#include <memory>
#include "p2p/base/basic_packet_socket_factory.h" #include "p2p/base/basic_packet_socket_factory.h"
#include "p2p/base/port_interface.h"
#include "rtc_base/async_packet_socket.h"
#include "rtc_base/socket_address.h"
#include "rtc_base/thread.h"
#include "rtc_base/virtual_socket_server.h" #include "rtc_base/virtual_socket_server.h"
#include "test/gtest.h" #include "test/gtest.h"

View file

@ -1426,6 +1426,7 @@ rtc_library("stream") {
":buffer", ":buffer",
":checks", ":checks",
":logging", ":logging",
":macromagic",
":threading", ":threading",
"../api:array_view", "../api:array_view",
"../api:sequence_checker", "../api:sequence_checker",

View file

@ -38,4 +38,7 @@ specific_include_rules = {
"openssl_stream_adapter.cc": [ "openssl_stream_adapter.cc": [
"+openssl", "+openssl",
], ],
"openssl_stream_adapter.h": [
"+openssl",
],
} }

View file

@ -33,8 +33,11 @@ rtc_library("fifo_buffer") {
"fifo_buffer.h", "fifo_buffer.h",
] ]
deps = [ deps = [
"..:macromagic",
"..:stream", "..:stream",
"..:threading", "..:threading",
"../../api:array_view",
"../../api:sequence_checker",
"../../api/task_queue:pending_task_safety_flag", "../../api/task_queue:pending_task_safety_flag",
] ]
} }

View file

@ -11,10 +11,16 @@
#ifndef RTC_BASE_MEMORY_FIFO_BUFFER_H_ #ifndef RTC_BASE_MEMORY_FIFO_BUFFER_H_
#define RTC_BASE_MEMORY_FIFO_BUFFER_H_ #define RTC_BASE_MEMORY_FIFO_BUFFER_H_
#include <cstddef>
#include <cstdint>
#include <memory> #include <memory>
#include "api/array_view.h"
#include "api/sequence_checker.h"
#include "api/task_queue/pending_task_safety_flag.h" #include "api/task_queue/pending_task_safety_flag.h"
#include "rtc_base/stream.h" #include "rtc_base/stream.h"
#include "rtc_base/thread.h"
#include "rtc_base/thread_annotations.h"
namespace rtc { namespace rtc {

View file

@ -22,8 +22,10 @@
#include "absl/functional/any_invocable.h" #include "absl/functional/any_invocable.h"
#include "absl/strings/string_view.h" #include "absl/strings/string_view.h"
#include "api/array_view.h"
#include "rtc_base/buffer.h" #include "rtc_base/buffer.h"
#ifdef OPENSSL_IS_BORINGSSL #ifdef OPENSSL_IS_BORINGSSL
#include "openssl/base.h"
#include "rtc_base/boringssl_identity.h" #include "rtc_base/boringssl_identity.h"
#else #else
#include "rtc_base/openssl_identity.h" #include "rtc_base/openssl_identity.h"
@ -32,9 +34,9 @@
#include "rtc_base/ssl_identity.h" #include "rtc_base/ssl_identity.h"
#include "rtc_base/ssl_stream_adapter.h" #include "rtc_base/ssl_stream_adapter.h"
#include "rtc_base/stream.h" #include "rtc_base/stream.h"
#include "rtc_base/system/rtc_export.h"
#include "rtc_base/task_utils/repeating_task.h" #include "rtc_base/task_utils/repeating_task.h"
#include "rtc_base/third_party/sigslot/sigslot.h" #include "rtc_base/third_party/sigslot/sigslot.h"
#include "rtc_base/thread.h"
namespace rtc { namespace rtc {

View file

@ -9,15 +9,11 @@
*/ */
#include "rtc_base/stream.h" #include "rtc_base/stream.h"
#include <errno.h>
#include <string.h> #include <string.h>
#include <algorithm> #include <cstdint>
#include <string>
#include "api/array_view.h" #include "api/array_view.h"
#include "rtc_base/checks.h"
#include "rtc_base/thread.h"
namespace rtc { namespace rtc {
@ -25,23 +21,20 @@ namespace rtc {
// StreamInterface // StreamInterface
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
StreamResult StreamInterface::WriteAll(const void* data, StreamResult StreamInterface::WriteAll(ArrayView<const uint8_t> data,
size_t data_len, size_t& written,
size_t* written, int& error) {
int* error) {
StreamResult result = SR_SUCCESS; StreamResult result = SR_SUCCESS;
size_t total_written = 0, current_written; size_t total_written = 0, current_written;
while (total_written < data_len) { while (total_written < data.size()) {
result = Write(ArrayView<const uint8_t>( rtc::ArrayView<const uint8_t> this_slice =
reinterpret_cast<const uint8_t*>(data) + total_written, data.subview(total_written, data.size() - total_written);
data_len - total_written), result = Write(this_slice, current_written, error);
current_written, *error);
if (result != SR_SUCCESS) if (result != SR_SUCCESS)
break; break;
total_written += current_written; total_written += current_written;
} }
if (written) written = total_written;
*written = total_written;
return result; return result;
} }

View file

@ -11,17 +11,18 @@
#ifndef RTC_BASE_STREAM_H_ #ifndef RTC_BASE_STREAM_H_
#define RTC_BASE_STREAM_H_ #define RTC_BASE_STREAM_H_
#include <memory> #include <cstddef>
#include <cstdint>
#include <utility>
#include "absl/functional/any_invocable.h" #include "absl/functional/any_invocable.h"
#include "api/array_view.h" #include "api/array_view.h"
#include "api/sequence_checker.h" #include "api/sequence_checker.h"
#include "rtc_base/buffer.h" #include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "rtc_base/system/no_unique_address.h" #include "rtc_base/system/no_unique_address.h"
#include "rtc_base/system/rtc_export.h" #include "rtc_base/system/rtc_export.h"
#include "rtc_base/third_party/sigslot/sigslot.h" #include "rtc_base/third_party/sigslot/sigslot.h"
#include "rtc_base/thread.h" #include "rtc_base/thread_annotations.h"
namespace rtc { namespace rtc {
@ -118,19 +119,9 @@ class RTC_EXPORT StreamInterface {
// unlike Write, the argument 'written' is always set, and may be non-zero // unlike Write, the argument 'written' is always set, and may be non-zero
// on results other than SR_SUCCESS. The remaining arguments have the // on results other than SR_SUCCESS. The remaining arguments have the
// same semantics as Write. // same semantics as Write.
[[deprecated("Use version with ArrayView")]] StreamResult
WriteAll(const void* data, size_t data_len, size_t* written, int* error);
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
// TODO(bugs.webrc.org/14632): Remove pragmas and change underlying
// implementation when downstream code is converted.
StreamResult WriteAll(ArrayView<const uint8_t> data, StreamResult WriteAll(ArrayView<const uint8_t> data,
size_t& written, size_t& written,
int& error) { int& error);
return WriteAll(data.data(), data.size(), &written, &error);
}
#pragma clang diagnostic pop
protected: protected:
StreamInterface(); StreamInterface();