This reverts commit eb0a591811.
This commit is contained in:
parent
eb0a591811
commit
a8ac4e7265
|
|
@ -31,7 +31,7 @@ class ChannelTestPeer {
|
|||
|
||||
/// Provide the gRPC Core channel
|
||||
grpc_channel* channel() const { return channel_->c_channel_; }
|
||||
size_t registered_calls() const;
|
||||
int registered_calls() const;
|
||||
int registration_attempts() const;
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -471,9 +471,9 @@ void PriorityLb::ChoosePriorityLocked() {
|
|||
}
|
||||
}
|
||||
// Did not find any child in CONNECTING, delegate to last child.
|
||||
SetCurrentPriorityLocked(
|
||||
static_cast<int32_t>(config_->priorities().size() - 1),
|
||||
/*deactivate_lower_priorities=*/false, "no usable children");
|
||||
SetCurrentPriorityLocked(config_->priorities().size() - 1,
|
||||
/*deactivate_lower_priorities=*/false,
|
||||
"no usable children");
|
||||
}
|
||||
|
||||
void PriorityLb::SetCurrentPriorityLocked(int32_t priority,
|
||||
|
|
|
|||
|
|
@ -1304,7 +1304,7 @@ static void perform_stream_op_locked(void* stream_op,
|
|||
if (op->send_message) {
|
||||
t->num_messages_in_next_write++;
|
||||
grpc_core::global_stats().IncrementHttp2SendMessageSize(
|
||||
static_cast<int>(op->payload->send_message.send_message->Length()));
|
||||
op->payload->send_message.send_message->Length());
|
||||
on_complete->next_data.scratch |= CLOSURE_BARRIER_MAY_COVER_WRITE;
|
||||
s->send_message_finished = add_closure_barrier(op->on_complete);
|
||||
const uint32_t flags = op_payload->send_message.flags;
|
||||
|
|
|
|||
|
|
@ -294,7 +294,7 @@ void TransportFlowControl::UpdateSetting(
|
|||
urgency = FlowControlAction::Urgency::UPDATE_IMMEDIATELY;
|
||||
}
|
||||
*desired_value = new_desired_value;
|
||||
(action->*set)(urgency, static_cast<uint32_t>(*desired_value));
|
||||
(action->*set)(urgency, *desired_value);
|
||||
}
|
||||
} else {
|
||||
int64_t delta = new_desired_value - *desired_value;
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ class TransportFlowControl final {
|
|||
BdpEstimator* bdp_estimator() { return &bdp_estimator_; }
|
||||
|
||||
uint32_t acked_init_window() const { return acked_init_window_; }
|
||||
int64_t sent_init_window() const { return target_initial_window_size_; }
|
||||
uint32_t sent_init_window() const { return target_initial_window_size_; }
|
||||
|
||||
FlowControlAction SetAckedInitialWindow(uint32_t value);
|
||||
|
||||
|
|
|
|||
|
|
@ -1104,8 +1104,7 @@ class HPackParser::Parser {
|
|||
const auto transport_size = key_string.size() + value_slice.size() +
|
||||
hpack_constants::kEntryOverhead;
|
||||
return grpc_metadata_batch::Parse(
|
||||
key->string_view(), std::move(value_slice),
|
||||
static_cast<uint32_t>(transport_size),
|
||||
key->string_view(), std::move(value_slice), transport_size,
|
||||
[key_string](absl::string_view error, const Slice& value) {
|
||||
ReportMetadataParseError(key_string, error, value.as_string_view());
|
||||
});
|
||||
|
|
|
|||
|
|
@ -229,8 +229,7 @@ HPackTable::Memento MakeMemento(size_t i) {
|
|||
auto sm = kStaticTable[i];
|
||||
return grpc_metadata_batch::Parse(
|
||||
sm.key, Slice::FromStaticString(sm.value),
|
||||
static_cast<uint32_t>(strlen(sm.key) + strlen(sm.value) +
|
||||
hpack_constants::kEntryOverhead),
|
||||
strlen(sm.key) + strlen(sm.value) + hpack_constants::kEntryOverhead,
|
||||
[](absl::string_view, const Slice&) {
|
||||
abort(); // not expecting to see this
|
||||
});
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ CompressionAlgorithmSet::CompressionAlgorithmForLevel(
|
|||
|
||||
CompressionAlgorithmSet CompressionAlgorithmSet::FromUint32(uint32_t value) {
|
||||
CompressionAlgorithmSet set;
|
||||
for (int i = 0; i < GRPC_COMPRESS_ALGORITHMS_COUNT; i++) {
|
||||
for (size_t i = 0; i < GRPC_COMPRESS_ALGORITHMS_COUNT; i++) {
|
||||
if (value & (1u << i)) {
|
||||
set.set_.set(i);
|
||||
}
|
||||
|
|
@ -185,7 +185,7 @@ CompressionAlgorithmSet::CompressionAlgorithmSet(
|
|||
|
||||
bool CompressionAlgorithmSet::IsSet(
|
||||
grpc_compression_algorithm algorithm) const {
|
||||
int i = algorithm;
|
||||
size_t i = static_cast<size_t>(algorithm);
|
||||
if (i < GRPC_COMPRESS_ALGORITHMS_COUNT) {
|
||||
return set_.is_set(i);
|
||||
} else {
|
||||
|
|
@ -194,7 +194,7 @@ bool CompressionAlgorithmSet::IsSet(
|
|||
}
|
||||
|
||||
void CompressionAlgorithmSet::Set(grpc_compression_algorithm algorithm) {
|
||||
int i = algorithm;
|
||||
size_t i = static_cast<size_t>(algorithm);
|
||||
if (i < GRPC_COMPRESS_ALGORITHMS_COUNT) {
|
||||
set_.set(i);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ TimerList::TimerList(TimerListHost* host)
|
|||
shard.queue_deadline_cap =
|
||||
grpc_core::Timestamp::FromMillisecondsAfterProcessEpoch(
|
||||
min_timer_.load(std::memory_order_relaxed));
|
||||
shard.shard_queue_index = static_cast<uint32_t>(i);
|
||||
shard.shard_queue_index = i;
|
||||
shard.list.next = shard.list.prev = &shard.list;
|
||||
shard.min_deadline = shard.ComputeMinDeadline();
|
||||
shard_queue_[i] = &shard;
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ void TimerHeap::AdjustDownwards(size_t i, Timer* t) {
|
|||
}
|
||||
|
||||
void TimerHeap::NoteChangedPriority(Timer* timer) {
|
||||
uint32_t i = static_cast<uint32_t>(timer->heap_index);
|
||||
uint32_t i = timer->heap_index;
|
||||
uint32_t parent = static_cast<uint32_t>((static_cast<int>(i) - 1) / 2);
|
||||
if (timers_[parent]->deadline > timer->deadline) {
|
||||
AdjustUpwards(i, timer);
|
||||
|
|
@ -86,7 +86,7 @@ bool TimerHeap::Add(Timer* timer) {
|
|||
}
|
||||
|
||||
void TimerHeap::Remove(Timer* timer) {
|
||||
size_t i = timer->heap_index;
|
||||
uint32_t i = timer->heap_index;
|
||||
if (i == timers_.size() - 1) {
|
||||
timers_.pop_back();
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ gpr_cycle_counter gpr_get_cycle_counter() {
|
|||
gpr_timespec gpr_cycle_counter_to_time(gpr_cycle_counter cycles) {
|
||||
gpr_timespec ts;
|
||||
ts.tv_sec = static_cast<int64_t>(cycles / GPR_US_PER_SEC);
|
||||
ts.tv_nsec = static_cast<int32_t>((cycles - ts.tv_sec * GPR_US_PER_SEC) *
|
||||
ts.tv_nsec = static_cast<int64_t>((cycles - ts.tv_sec * GPR_US_PER_SEC) *
|
||||
GPR_NS_PER_US);
|
||||
ts.clock_type = GPR_CLOCK_PRECISE;
|
||||
return ts;
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ class BitSet {
|
|||
ToInt() const {
|
||||
Int result = 0;
|
||||
for (size_t i = 0; i < kTotalBits; i++) {
|
||||
if (is_set(static_cast<int>(i))) result |= (Int(1) << i);
|
||||
if (is_set(i)) result |= (Int(1) << i);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -269,7 +269,7 @@ void StatusAddChild(absl::Status* status, absl::Status child) {
|
|||
children = *old_children;
|
||||
}
|
||||
char head_buf[sizeof(uint32_t)];
|
||||
EncodeUInt32ToBytes(static_cast<uint32_t>(buf_len), head_buf);
|
||||
EncodeUInt32ToBytes(buf_len, head_buf);
|
||||
children.Append(absl::string_view(head_buf, sizeof(uint32_t)));
|
||||
children.Append(absl::string_view(buf, buf_len));
|
||||
status->SetPayload(kChildrenPropertyUrl, std::move(children));
|
||||
|
|
|
|||
|
|
@ -244,7 +244,7 @@ static void on_writable(void* acp, grpc_error_handle error) {
|
|||
|
||||
finish:
|
||||
if (!connect_cancelled) {
|
||||
size_t shard_number = ac->connection_handle % (*g_connection_shards).size();
|
||||
int shard_number = ac->connection_handle % (*g_connection_shards).size();
|
||||
struct ConnectionShard* shard = &(*g_connection_shards)[shard_number];
|
||||
{
|
||||
grpc_core::MutexLock lock(&shard->mu);
|
||||
|
|
@ -379,7 +379,7 @@ int64_t grpc_tcp_client_create_from_prepared_fd(
|
|||
ac->addr_str.c_str(), fdobj);
|
||||
}
|
||||
|
||||
size_t shard_number = connection_id % (*g_connection_shards).size();
|
||||
int shard_number = connection_id % (*g_connection_shards).size();
|
||||
struct ConnectionShard* shard = &(*g_connection_shards)[shard_number];
|
||||
{
|
||||
grpc_core::MutexLock lock(&shard->mu);
|
||||
|
|
@ -417,7 +417,7 @@ static bool tcp_cancel_connect(int64_t connection_handle) {
|
|||
if (connection_handle <= 0) {
|
||||
return false;
|
||||
}
|
||||
size_t shard_number = connection_handle % (*g_connection_shards).size();
|
||||
int shard_number = connection_handle % (*g_connection_shards).size();
|
||||
struct ConnectionShard* shard = &(*g_connection_shards)[shard_number];
|
||||
async_connect* ac = nullptr;
|
||||
{
|
||||
|
|
|
|||
|
|
@ -914,9 +914,9 @@ static bool tcp_do_read(grpc_tcp* tcp, grpc_error_handle* error)
|
|||
msg.msg_flags = 0;
|
||||
|
||||
grpc_core::global_stats().IncrementTcpReadOffer(
|
||||
static_cast<int>(tcp->incoming_buffer->length));
|
||||
tcp->incoming_buffer->length);
|
||||
grpc_core::global_stats().IncrementTcpReadOfferIovSize(
|
||||
static_cast<int>(tcp->incoming_buffer->count));
|
||||
tcp->incoming_buffer->count);
|
||||
|
||||
do {
|
||||
grpc_core::global_stats().IncrementSyscallRead();
|
||||
|
|
@ -955,8 +955,7 @@ static bool tcp_do_read(grpc_tcp* tcp, grpc_error_handle* error)
|
|||
return true;
|
||||
}
|
||||
|
||||
grpc_core::global_stats().IncrementTcpReadSize(
|
||||
static_cast<int>(read_bytes));
|
||||
grpc_core::global_stats().IncrementTcpReadSize(read_bytes);
|
||||
add_to_estimate(tcp, static_cast<size_t>(read_bytes));
|
||||
GPR_DEBUG_ASSERT((size_t)read_bytes <=
|
||||
tcp->incoming_buffer->length - total_read_bytes);
|
||||
|
|
@ -1058,8 +1057,8 @@ static void maybe_make_read_slices(grpc_tcp* tcp)
|
|||
if (low_memory_pressure && target_length > allocate_length) {
|
||||
allocate_length = target_length;
|
||||
}
|
||||
int extra_wanted = static_cast<int>(allocate_length) -
|
||||
static_cast<int>(tcp->incoming_buffer->length);
|
||||
int extra_wanted =
|
||||
allocate_length - static_cast<int>(tcp->incoming_buffer->length);
|
||||
if (extra_wanted >=
|
||||
(low_memory_pressure ? kSmallAlloc * 3 / 2 : kBigAlloc)) {
|
||||
while (extra_wanted > 0) {
|
||||
|
|
@ -1603,8 +1602,7 @@ static bool do_tcp_flush_zerocopy(grpc_tcp* tcp, TcpZerocopySendRecord* record,
|
|||
if (!tried_sending_message) {
|
||||
msg.msg_control = nullptr;
|
||||
msg.msg_controllen = 0;
|
||||
grpc_core::global_stats().IncrementTcpWriteSize(
|
||||
static_cast<int>(sending_length));
|
||||
grpc_core::global_stats().IncrementTcpWriteSize(sending_length);
|
||||
grpc_core::global_stats().IncrementTcpWriteIovSize(iov_size);
|
||||
sent_length = tcp_send(tcp->fd, &msg, &saved_errno, MSG_ZEROCOPY);
|
||||
}
|
||||
|
|
@ -1717,8 +1715,7 @@ static bool tcp_flush(grpc_tcp* tcp, grpc_error_handle* error) {
|
|||
msg.msg_control = nullptr;
|
||||
msg.msg_controllen = 0;
|
||||
|
||||
grpc_core::global_stats().IncrementTcpWriteSize(
|
||||
static_cast<int>(sending_length));
|
||||
grpc_core::global_stats().IncrementTcpWriteSize(sending_length);
|
||||
grpc_core::global_stats().IncrementTcpWriteIovSize(iov_size);
|
||||
|
||||
sent_length = tcp_send(tcp->fd, &msg, &saved_errno);
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ grpc_slice CreateRootCertsBundle(const char* certs_directory) {
|
|||
if (file_descriptor != -1) {
|
||||
// Read file into bundle.
|
||||
size_t cert_file_size = roots_filenames[i].size;
|
||||
ssize_t read_ret =
|
||||
int read_ret =
|
||||
read(file_descriptor, bundle_string + bytes_read, cert_file_size);
|
||||
if (read_ret != -1) {
|
||||
bytes_read += read_ret;
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ struct CopyConstructors {
|
|||
|
||||
static Out FromInt64(int64_t i) {
|
||||
char buffer[GPR_LTOA_MIN_BUFSIZE];
|
||||
int64_ttoa(i, buffer);
|
||||
gpr_ltoa(i, buffer);
|
||||
return FromCopiedString(buffer);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ inline absl::string_view StringViewFromSlice(const grpc_slice& slice) {
|
|||
} // namespace grpc_core
|
||||
|
||||
inline uint32_t grpc_slice_hash(const grpc_slice& s) {
|
||||
return static_cast<uint32_t>(absl::HashOf(grpc_core::StringViewFromSlice(s)));
|
||||
return absl::HashOf(grpc_core::StringViewFromSlice(s));
|
||||
}
|
||||
|
||||
namespace grpc_core {
|
||||
|
|
|
|||
|
|
@ -636,7 +636,7 @@ grpc_error_handle FilterStackCall::Create(grpc_call_create_args* args,
|
|||
grpc_error_handle error;
|
||||
grpc_channel_stack* channel_stack = channel->channel_stack();
|
||||
size_t initial_size = channel->CallSizeEstimate();
|
||||
global_stats().IncrementCallInitialSize(static_cast<int>(initial_size));
|
||||
global_stats().IncrementCallInitialSize(initial_size);
|
||||
size_t call_alloc_size =
|
||||
GPR_ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(FilterStackCall)) +
|
||||
channel_stack->call_stack_size;
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ class Channel : public RefCounted<Channel>,
|
|||
bool is_promising() const { return is_promising_; }
|
||||
RegisteredCall* RegisterCall(const char* method, const char* host);
|
||||
|
||||
size_t TestOnlyRegisteredCalls() {
|
||||
int TestOnlyRegisteredCalls() {
|
||||
MutexLock lock(®istration_table_.mu);
|
||||
return registration_table_.map.size();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -217,8 +217,8 @@ static tsi_result alts_zero_copy_grpc_protector_unprotect(
|
|||
}
|
||||
if (min_progress_size != nullptr) {
|
||||
if (protector->parsed_frame_size > kZeroCopyFrameLengthFieldSize) {
|
||||
*min_progress_size = static_cast<int>(protector->parsed_frame_size -
|
||||
protector->protected_sb.length);
|
||||
*min_progress_size =
|
||||
protector->parsed_frame_size - protector->protected_sb.length;
|
||||
} else {
|
||||
*min_progress_size = 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -485,8 +485,7 @@ static tsi_result fake_zero_copy_grpc_protector_unprotect(
|
|||
}
|
||||
if (min_progress_size != nullptr) {
|
||||
if (impl->parsed_frame_size > TSI_FAKE_FRAME_HEADER_SIZE) {
|
||||
*min_progress_size =
|
||||
static_cast<int>(impl->parsed_frame_size - impl->protected_sb.length);
|
||||
*min_progress_size = impl->parsed_frame_size - impl->protected_sb.length;
|
||||
} else {
|
||||
*min_progress_size = 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <grpcpp/channel.h>
|
||||
#include <grpcpp/test/channel_test_peer.h>
|
||||
|
||||
|
|
@ -26,7 +24,7 @@
|
|||
namespace grpc {
|
||||
namespace testing {
|
||||
|
||||
size_t ChannelTestPeer::registered_calls() const {
|
||||
int ChannelTestPeer::registered_calls() const {
|
||||
return grpc_core::Channel::FromC(channel_->c_channel_)
|
||||
->TestOnlyRegisteredCalls();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -859,7 +859,7 @@ TEST_P(End2endTest, MultipleRpcs) {
|
|||
TEST_P(End2endTest, ManyStubs) {
|
||||
ResetStub();
|
||||
ChannelTestPeer peer(channel_.get());
|
||||
size_t registered_calls_pre = peer.registered_calls();
|
||||
int registered_calls_pre = peer.registered_calls();
|
||||
int registration_attempts_pre = peer.registration_attempts();
|
||||
for (int i = 0; i < 1000; ++i) {
|
||||
grpc::testing::EchoTestService::NewStub(channel_);
|
||||
|
|
|
|||
Loading…
Reference in New Issue