Skip to content

Commit

Permalink
Rerun clang-formatter-7
Browse files Browse the repository at this point in the history
  • Loading branch information
veblush committed Mar 3, 2020
1 parent 1a4c8df commit 415d41f
Show file tree
Hide file tree
Showing 91 changed files with 585 additions and 558 deletions.
12 changes: 6 additions & 6 deletions include/grpcpp/impl/codegen/server_context_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -513,9 +513,6 @@ class ServerContext : public ServerContextBase {

using ServerContextBase::AddInitialMetadata;
using ServerContextBase::AddTrailingMetadata;
using ServerContextBase::IsCancelled;
using ServerContextBase::SetLoadReportingCosts;
using ServerContextBase::TryCancel;
using ServerContextBase::auth_context;
using ServerContextBase::c_call;
using ServerContextBase::census_context;
Expand All @@ -524,10 +521,13 @@ class ServerContext : public ServerContextBase {
using ServerContextBase::compression_level;
using ServerContextBase::compression_level_set;
using ServerContextBase::deadline;
using ServerContextBase::IsCancelled;
using ServerContextBase::peer;
using ServerContextBase::raw_deadline;
using ServerContextBase::set_compression_algorithm;
using ServerContextBase::set_compression_level;
using ServerContextBase::SetLoadReportingCosts;
using ServerContextBase::TryCancel;

// Sync/CQ-based Async ServerContext only
using ServerContextBase::AsyncNotifyWhenDone;
Expand Down Expand Up @@ -555,9 +555,6 @@ class CallbackServerContext : public ServerContextBase {

using ServerContextBase::AddInitialMetadata;
using ServerContextBase::AddTrailingMetadata;
using ServerContextBase::IsCancelled;
using ServerContextBase::SetLoadReportingCosts;
using ServerContextBase::TryCancel;
using ServerContextBase::auth_context;
using ServerContextBase::c_call;
using ServerContextBase::census_context;
Expand All @@ -566,10 +563,13 @@ class CallbackServerContext : public ServerContextBase {
using ServerContextBase::compression_level;
using ServerContextBase::compression_level_set;
using ServerContextBase::deadline;
using ServerContextBase::IsCancelled;
using ServerContextBase::peer;
using ServerContextBase::raw_deadline;
using ServerContextBase::set_compression_algorithm;
using ServerContextBase::set_compression_level;
using ServerContextBase::SetLoadReportingCosts;
using ServerContextBase::TryCancel;

// CallbackServerContext only
using ServerContextBase::DefaultReactor;
Expand Down
2 changes: 1 addition & 1 deletion include/grpcpp/server_posix_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ void AddInsecureChannelFromFd(grpc::Server* server, int fd);

#endif // GPR_SUPPORT_CHANNELS_FROM_FD

} // namespace grpc
} // namespace grpc_impl

#endif // GRPCPP_SERVER_POSIX_IMPL_H
2 changes: 1 addition & 1 deletion src/compiler/csharp_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ using grpc::protobuf::ServiceDescriptor;
using grpc::protobuf::io::Printer;
using grpc::protobuf::io::StringOutputStream;
using grpc_generator::GetMethodType;
using grpc_generator::MethodType;
using grpc_generator::METHODTYPE_BIDI_STREAMING;
using grpc_generator::METHODTYPE_CLIENT_STREAMING;
using grpc_generator::METHODTYPE_NO_STREAMING;
using grpc_generator::METHODTYPE_SERVER_STREAMING;
using grpc_generator::MethodType;
using grpc_generator::StringReplace;
using std::map;
using std::vector;
Expand Down
1 change: 0 additions & 1 deletion src/compiler/objective_c_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

using ::google::protobuf::compiler::objectivec::ClassName;
using ::grpc::protobuf::FileDescriptor;
using ::grpc::protobuf::FileDescriptor;
using ::grpc::protobuf::MethodDescriptor;
using ::grpc::protobuf::ServiceDescriptor;
using ::grpc::protobuf::io::Printer;
Expand Down
3 changes: 1 addition & 2 deletions src/compiler/objective_c_generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ struct Parameters {
bool no_v1_compatibility;
};

using ::grpc::protobuf::FileDescriptor;
using ::grpc::string;
using ::grpc::protobuf::FileDescriptor;
using ::grpc::protobuf::ServiceDescriptor;
using ::grpc::string;

// Returns forward declaration of classes in the generated header file.
string GetAllMessageClasses(const FileDescriptor* file);
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/objective_c_generator_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@

namespace grpc_objective_c_generator {

using ::grpc::string;
using ::grpc::protobuf::FileDescriptor;
using ::grpc::protobuf::ServiceDescriptor;
using ::grpc::string;

inline string MessageHeaderName(const FileDescriptor* file) {
return google::protobuf::compiler::objectivec::FilePath(file) + ".pbobjc.h";
Expand Down
13 changes: 6 additions & 7 deletions src/core/ext/filters/client_channel/xds/xds_client_stats.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,12 @@ uint64_t GetAndResetCounter(Atomic<uint64_t>* from) {

XdsClusterLocalityStats::Snapshot
XdsClusterLocalityStats::GetSnapshotAndReset() {
Snapshot snapshot = {
GetAndResetCounter(&total_successful_requests_),
// Don't reset total_requests_in_progress because it's not
// related to a single reporting interval.
total_requests_in_progress_.Load(MemoryOrder::RELAXED),
GetAndResetCounter(&total_error_requests_),
GetAndResetCounter(&total_issued_requests_)};
Snapshot snapshot = {GetAndResetCounter(&total_successful_requests_),
// Don't reset total_requests_in_progress because it's
// not related to a single reporting interval.
total_requests_in_progress_.Load(MemoryOrder::RELAXED),
GetAndResetCounter(&total_error_requests_),
GetAndResetCounter(&total_issued_requests_)};
MutexLock lock(&backend_metrics_mu_);
snapshot.backend_metrics = std::move(backend_metrics_);
return snapshot;
Expand Down
2 changes: 1 addition & 1 deletion src/core/lib/gpr/time_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ static gpr_timespec now_impl(gpr_clock_type clock_type) {
}
}
#else
/* For some reason Apple's OSes haven't implemented clock_gettime. */
/* For some reason Apple's OSes haven't implemented clock_gettime. */

#include <mach/mach.h>
#include <mach/mach_time.h>
Expand Down
2 changes: 1 addition & 1 deletion src/core/lib/gprpp/fork.cc
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class ThreadState {
int count_;
};

} // namespace
} // namespace internal

void Fork::GlobalInit() {
if (!override_enabled_) {
Expand Down
5 changes: 2 additions & 3 deletions src/core/lib/iomgr/ev_epoll1_linux.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1116,9 +1116,8 @@ static grpc_error* pollset_kick(grpc_pollset* pollset,
}
SET_KICK_STATE(next_worker, KICKED);
goto done;
} else if (root_worker ==
next_worker && // only try and wake up a poller if
// there is no next worker
} else if (root_worker == next_worker && // only try and wake up a poller
// if there is no next worker
root_worker == (grpc_pollset_worker*)gpr_atm_no_barrier_load(
&g_active_poller)) {
GRPC_STATS_INC_POLLSET_KICK_WAKEUP_FD();
Expand Down
6 changes: 3 additions & 3 deletions src/core/lib/iomgr/ev_poll_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,9 @@ static void fork_fd_list_add_wakeup_fd(grpc_cached_wakeup_fd* fd) {
}
}

/*******************************************************************************
* fd_posix.c
*/
/*******************************************************************************
* fd_posix.c
*/

#ifndef NDEBUG
#define REF_BY(fd, n, reason) ref_by(fd, n, reason, __FILE__, __LINE__)
Expand Down
6 changes: 3 additions & 3 deletions src/core/lib/transport/metadata.cc
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,9 @@ void grpc_mdctx_global_shutdown() {
abort();
}
}
// For ASAN builds, we don't want to crash here, because that will
// prevent ASAN from providing leak detection information, which is
// far more useful than this simple assertion.
// For ASAN builds, we don't want to crash here, because that will
// prevent ASAN from providing leak detection information, which is
// far more useful than this simple assertion.
#ifndef GRPC_ASAN_ENABLED
GPR_DEBUG_ASSERT(shard->count == 0);
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/core/lib/transport/static_metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ constexpr uint64_t kGrpcStaticMetadataInitCanary = 0xCAFEF00DC0FFEE11L;
uint64_t StaticMetadataInitCanary();
#endif
extern const StaticMetadataSlice* g_static_metadata_slice_table;
}
} // namespace grpc_core
inline const grpc_core::StaticMetadataSlice* grpc_static_slice_table() {
GPR_DEBUG_ASSERT(grpc_core::StaticMetadataInitCanary() ==
grpc_core::kGrpcStaticMetadataInitCanary);
Expand Down
7 changes: 3 additions & 4 deletions src/objective-c/GRPCClient/GRPCCall+ChannelArg.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@

+ (void)setUserAgentPrefix:(nonnull NSString *)userAgentPrefix forHost:(nonnull NSString *)host;
+ (void)setResponseSizeLimit:(NSUInteger)limit forHost:(nonnull NSString *)host;
+ (void)closeOpenConnections DEPRECATED_MSG_ATTRIBUTE(
"The API for this feature is experimental, "
"and might be removed or modified at any "
"time.");
+ (void)closeOpenConnections DEPRECATED_MSG_ATTRIBUTE("The API for this feature is experimental, "
"and might be removed or modified at any "
"time.");
+ (void)setDefaultCompressMethod:(GRPCCompressAlgorithm)algorithm forhost:(nonnull NSString *)host;
+ (void)setKeepaliveWithInterval:(int)interval
timeout:(int)timeout
Expand Down
2 changes: 1 addition & 1 deletion src/objective-c/GRPCClient/GRPCCall+GID.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
/**
* Extend GIDSignIn class to comply GRPCAuthorizationProtocol
*/
@interface GIDSignIn (GRPC)<GRPCAuthorizationProtocol>
@interface GIDSignIn (GRPC) <GRPCAuthorizationProtocol>
- (void)getTokenWithHandler:(void (^)(NSString *token))hander;
@end
8 changes: 4 additions & 4 deletions src/objective-c/GRPCClient/GRPCCall+Interceptor.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ + (void)registerGlobalInterceptor:(id<GRPCInterceptorFactory>)interceptorFactory
[globalInterceptorLock lock];
if (globalInterceptorFactory != nil) {
[globalInterceptorLock unlock];
[NSException raise:NSInternalInconsistencyException
format:
@"Global interceptor is already registered. Only one global interceptor can be "
@"registered in a process."];
[NSException
raise:NSInternalInconsistencyException
format:@"Global interceptor is already registered. Only one global interceptor can be "
@"registered in a process."];
return;
}

Expand Down
5 changes: 3 additions & 2 deletions src/objective-c/GRPCClient/GRPCCall+Tests.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ + (void)useTestCertsPath:(NSString *)certsPath
[NSException raise:NSInvalidArgumentException format:@"testname must be provided."];
}
NSError *error = nil;
NSString *certs =
[NSString stringWithContentsOfFile:certsPath encoding:NSUTF8StringEncoding error:&error];
NSString *certs = [NSString stringWithContentsOfFile:certsPath
encoding:NSUTF8StringEncoding
error:&error];
if (error != nil) {
[NSException raise:[error localizedDescription] format:@"failed to load certs"];
}
Expand Down
8 changes: 4 additions & 4 deletions src/objective-c/GRPCClient/GRPCCall.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
NS_ASSUME_NONNULL_BEGIN

/** An object can implement this protocol to receive responses from server from a call. */
@protocol GRPCResponseHandler<NSObject, GRPCDispatchable>
@protocol GRPCResponseHandler <NSObject, GRPCDispatchable>

@optional

Expand Down Expand Up @@ -99,11 +99,11 @@ NS_ASSUME_NONNULL_BEGIN
* HTTP request parameters. If Protobuf is used, these parameters are automatically generated by
* Protobuf. If directly using the GRPCCall2 class, users should specify these parameters manually.
*/
@interface GRPCRequestOptions : NSObject<NSCopying>
@interface GRPCRequestOptions : NSObject <NSCopying>

- (instancetype)init NS_UNAVAILABLE;

+ (instancetype) new NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;

/** Initialize with all properties. */
- (instancetype)initWithHost:(NSString *)host
Expand Down Expand Up @@ -131,7 +131,7 @@ NS_ASSUME_NONNULL_BEGIN

- (instancetype)init NS_UNAVAILABLE;

+ (instancetype) new NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;

/**
* Designated initializer for a call.
Expand Down
12 changes: 7 additions & 5 deletions src/objective-c/GRPCClient/GRPCCall.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* dispatch queue of a user provided response handler. It removes the requirement of having to use
* serial dispatch queue in the user provided response handler.
*/
@interface GRPCResponseDispatcher : NSObject<GRPCResponseHandler>
@interface GRPCResponseDispatcher : NSObject <GRPCResponseHandler>

- (nullable instancetype)initWithResponseHandler:(id<GRPCResponseHandler>)responseHandler;

Expand Down Expand Up @@ -117,8 +117,9 @@ - (instancetype)initWithHost:(NSString *)host path:(NSString *)path safety:(GRPC
}

- (id)copyWithZone:(NSZone *)zone {
GRPCRequestOptions *request =
[[GRPCRequestOptions alloc] initWithHost:_host path:_path safety:_safety];
GRPCRequestOptions *request = [[GRPCRequestOptions alloc] initWithHost:_host
path:_path
safety:_safety];

return request;
}
Expand Down Expand Up @@ -221,8 +222,9 @@ - (instancetype)initWithRequestOptions:(GRPCRequestOptions *)requestOptions

- (instancetype)initWithRequestOptions:(GRPCRequestOptions *)requestOptions
responseHandler:(id<GRPCResponseHandler>)responseHandler {
return
[self initWithRequestOptions:requestOptions responseHandler:responseHandler callOptions:nil];
return [self initWithRequestOptions:requestOptions
responseHandler:responseHandler
callOptions:nil];
}

- (void)start {
Expand Down
4 changes: 2 additions & 2 deletions src/objective-c/GRPCClient/GRPCCallLegacy.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@

/** This protocol is kept for backwards compatibility with existing code. */
DEPRECATED_MSG_ATTRIBUTE("Use NSDictionary or NSMutableDictionary instead.")
@protocol GRPCRequestHeaders<NSObject>
@protocol GRPCRequestHeaders <NSObject>
@property(nonatomic, readonly) NSUInteger count;

- (id)objectForKeyedSubscript:(id)key;
Expand All @@ -125,7 +125,7 @@ DEPRECATED_MSG_ATTRIBUTE("Use NSDictionary or NSMutableDictionary instead.")
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated"
/** This is only needed for backwards-compatibility. */
@interface NSMutableDictionary (GRPCRequestHeaders)<GRPCRequestHeaders>
@interface NSMutableDictionary (GRPCRequestHeaders) <GRPCRequestHeaders>
@end
#pragma clang diagnostic pop
#pragma clang diagnostic pop
45 changes: 23 additions & 22 deletions src/objective-c/GRPCClient/GRPCCallLegacy.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
static NSString *const kAuthorizationHeader = @"authorization";
static NSString *const kBearerPrefix = @"Bearer ";

@interface GRPCCall ()<GRXWriteable>
@interface GRPCCall () <GRXWriteable>
// Make them read-write.
@property(atomic, strong) NSDictionary *responseHeaders;
@property(atomic, strong) NSDictionary *responseTrailers;
Expand Down Expand Up @@ -429,8 +429,8 @@ - (void)writeMessage:(NSData *)message withErrorHandler:(void (^)(void))errorHan
}
}
};
GRPCOpSendMessage *op =
[[GRPCOpSendMessage alloc] initWithMessage:message handler:resumingHandler];
GRPCOpSendMessage *op = [[GRPCOpSendMessage alloc] initWithMessage:message
handler:resumingHandler];
if (!_unaryCall) {
[_wrappedCall startBatchWithOperations:@[ op ] errorHandler:errorHandler];
} else {
Expand Down Expand Up @@ -501,22 +501,23 @@ - (void)invokeCallWithHeadersHandler:(void (^)(NSDictionary *))headersHandler

- (void)invokeCall {
__weak GRPCCall *weakSelf = self;
[self invokeCallWithHeadersHandler:^(NSDictionary *headers) {
// Response headers received.
__strong GRPCCall *strongSelf = weakSelf;
if (strongSelf) {
@synchronized(strongSelf) {
// it is ok to set nil because headers are only received once
strongSelf.responseHeaders = nil;
// copy the header so that the GRPCOpRecvMetadata object may be dealloc'ed
NSDictionary *copiedHeaders =
[[NSDictionary alloc] initWithDictionary:headers copyItems:YES];
strongSelf.responseHeaders = copiedHeaders;
strongSelf->_pendingCoreRead = NO;
[strongSelf maybeStartNextRead];
[self
invokeCallWithHeadersHandler:^(NSDictionary *headers) {
// Response headers received.
__strong GRPCCall *strongSelf = weakSelf;
if (strongSelf) {
@synchronized(strongSelf) {
// it is ok to set nil because headers are only received once
strongSelf.responseHeaders = nil;
// copy the header so that the GRPCOpRecvMetadata object may be dealloc'ed
NSDictionary *copiedHeaders = [[NSDictionary alloc] initWithDictionary:headers
copyItems:YES];
strongSelf.responseHeaders = copiedHeaders;
strongSelf->_pendingCoreRead = NO;
[strongSelf maybeStartNextRead];
}
}
}
}
}
completionHandler:^(NSError *error, NSDictionary *trailers) {
__strong GRPCCall *strongSelf = weakSelf;
if (strongSelf) {
Expand Down Expand Up @@ -548,11 +549,11 @@ - (void)startCallWithWriteable:(id<GRXWriteable>)writeable {
return;
}

_responseWriteable =
[[GRXConcurrentWriteable alloc] initWithWriteable:writeable dispatchQueue:_responseQueue];
_responseWriteable = [[GRXConcurrentWriteable alloc] initWithWriteable:writeable
dispatchQueue:_responseQueue];

GRPCPooledChannel *channel =
[[GRPCChannelPool sharedInstance] channelWithHost:_host callOptions:_callOptions];
GRPCPooledChannel *channel = [[GRPCChannelPool sharedInstance] channelWithHost:_host
callOptions:_callOptions];
_wrappedCall = [channel wrappedCallWithPath:_path
completionQueue:[GRPCCompletionQueue completionQueue]
callOptions:_callOptions];
Expand Down
Loading

0 comments on commit 415d41f

Please sign in to comment.