Reformat the WebRTC code base

Running clang-format with chromium's style guide.

The goal is n-fold:
 * providing consistency and readability (that's what code guidelines are for)
 * preventing noise with presubmit checks and git cl format
 * building on the previous point: making it easier to automatically fix format issues
 * you name it

Please consider using git-hyper-blame to ignore this commit.

Bug: webrtc:9340
Change-Id: I694567c4cdf8cee2860958cfe82bfaf25848bb87
Reviewed-on: https://webrtc-review.googlesource.com/81185
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23660}
This commit is contained in:
Yves Gerey
2018-06-19 15:03:05 +02:00
parent b602123a5a
commit 665174fdbb
1569 changed files with 30495 additions and 30309 deletions

View File

@ -47,8 +47,10 @@ jlong PointerTojlong(void* ptr) {
return ret;
}
jmethodID GetMethodID (
JNIEnv* jni, jclass c, const char* name, const char* signature) {
jmethodID GetMethodID(JNIEnv* jni,
jclass c,
const char* name,
const char* signature) {
jmethodID m = jni->GetMethodID(c, name, signature);
CHECK_EXCEPTION(jni) << "Error during GetMethodID: " << name << ", "
<< signature;
@ -56,8 +58,10 @@ jmethodID GetMethodID (
return m;
}
jmethodID GetStaticMethodID (
JNIEnv* jni, jclass c, const char* name, const char* signature) {
jmethodID GetStaticMethodID(JNIEnv* jni,
jclass c,
const char* name,
const char* signature) {
jmethodID m = jni->GetStaticMethodID(c, name, signature);
CHECK_EXCEPTION(jni) << "Error during GetStaticMethodID: " << name << ", "
<< signature;
@ -107,6 +111,8 @@ AttachThreadScoped::~AttachThreadScoped() {
}
}
JNIEnv* AttachThreadScoped::env() { return env_; }
JNIEnv* AttachThreadScoped::env() {
return env_;
}
} // namespace webrtc

View File

@ -27,10 +27,10 @@ struct {
const char* name;
jclass clazz;
} loaded_classes[] = {
{"org/webrtc/voiceengine/BuildInfo", nullptr},
{"org/webrtc/voiceengine/WebRtcAudioManager", nullptr},
{"org/webrtc/voiceengine/WebRtcAudioRecord", nullptr},
{"org/webrtc/voiceengine/WebRtcAudioTrack", nullptr},
{"org/webrtc/voiceengine/BuildInfo", nullptr},
{"org/webrtc/voiceengine/WebRtcAudioManager", nullptr},
{"org/webrtc/voiceengine/WebRtcAudioRecord", nullptr},
{"org/webrtc/voiceengine/WebRtcAudioTrack", nullptr},
};
// Android's FindClass() is trickier than usual because the app-specific
@ -68,8 +68,7 @@ jclass LookUpClass(const char* name) {
}
// AttachCurrentThreadIfNeeded implementation.
AttachCurrentThreadIfNeeded::AttachCurrentThreadIfNeeded()
: attached_(false) {
AttachCurrentThreadIfNeeded::AttachCurrentThreadIfNeeded() : attached_(false) {
RTC_LOG(INFO) << "AttachCurrentThreadIfNeeded::ctor";
JavaVM* jvm = JVM::GetInstance()->jvm();
RTC_CHECK(jvm);
@ -141,27 +140,26 @@ NativeRegistration::~NativeRegistration() {
CHECK_EXCEPTION(jni_) << "Error during UnregisterNatives";
}
std::unique_ptr<GlobalRef> NativeRegistration::NewObject(
const char* name, const char* signature, ...) {
std::unique_ptr<GlobalRef> NativeRegistration::NewObject(const char* name,
const char* signature,
...) {
RTC_LOG(INFO) << "NativeRegistration::NewObject";
va_list args;
va_start(args, signature);
jobject obj = jni_->NewObjectV(j_class_,
GetMethodID(jni_, j_class_, name, signature),
args);
jobject obj = jni_->NewObjectV(
j_class_, GetMethodID(jni_, j_class_, name, signature), args);
CHECK_EXCEPTION(jni_) << "Error during NewObjectV";
va_end(args);
return std::unique_ptr<GlobalRef>(new GlobalRef(jni_, obj));
}
// JavaClass implementation.
jmethodID JavaClass::GetMethodId(
const char* name, const char* signature) {
jmethodID JavaClass::GetMethodId(const char* name, const char* signature) {
return GetMethodID(jni_, j_class_, name, signature);
}
jmethodID JavaClass::GetStaticMethodId(
const char* name, const char* signature) {
jmethodID JavaClass::GetStaticMethodId(const char* name,
const char* signature) {
return GetStaticMethodID(jni_, j_class_, name, signature);
}
@ -192,7 +190,9 @@ JNIEnvironment::~JNIEnvironment() {
}
std::unique_ptr<NativeRegistration> JNIEnvironment::RegisterNatives(
const char* name, const JNINativeMethod *methods, int num_methods) {
const char* name,
const JNINativeMethod* methods,
int num_methods) {
RTC_LOG(INFO) << "JNIEnvironment::RegisterNatives: " << name;
RTC_DCHECK(thread_checker_.CalledOnValidThread());
jclass clazz = LookUpClass(name);

View File

@ -32,13 +32,12 @@ int64_t GetNextCallbackTime(Module* module, int64_t time_now) {
}
return time_now + interval;
}
}
} // namespace
ProcessThread::~ProcessThread() {}
// static
std::unique_ptr<ProcessThread> ProcessThread::Create(
const char* thread_name) {
std::unique_ptr<ProcessThread> ProcessThread::Create(const char* thread_name) {
return std::unique_ptr<ProcessThread>(new ProcessThreadImpl(thread_name));
}
@ -76,7 +75,7 @@ void ProcessThreadImpl::Start() {
void ProcessThreadImpl::Stop() {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
if(!thread_.get())
if (!thread_.get())
return;
{
@ -155,9 +154,8 @@ void ProcessThreadImpl::DeRegisterModule(Module* module) {
{
rtc::CritScope lock(&lock_);
modules_.remove_if([&module](const ModuleCallback& m) {
return m.module == module;
});
modules_.remove_if(
[&module](const ModuleCallback& m) { return m.module == module; });
}
// Notify the module that it's been detached.

View File

@ -85,4 +85,4 @@ class ProcessThreadImpl : public ProcessThread {
} // namespace webrtc
#endif // MODULES_UTILITY_SOURCE_PROCESS_THREAD_IMPL_H_
#endif // MODULES_UTILITY_SOURCE_PROCESS_THREAD_IMPL_H_

View File

@ -137,9 +137,8 @@ TEST(ProcessThreadImpl, Deregister) {
.WillOnce(Return(0))
.WillRepeatedly(Return(1));
EXPECT_CALL(module, Process())
.WillOnce(DoAll(SetEvent(event.get()),
Increment(&process_count),
Return()))
.WillOnce(
DoAll(SetEvent(event.get()), Increment(&process_count), Return()))
.WillRepeatedly(DoAll(Increment(&process_count), Return()));
thread.RegisterModule(&module, RTC_FROM_HERE);
@ -174,13 +173,11 @@ void ProcessCallAfterAFewMs(int64_t milliseconds) {
int64_t start_time = 0;
int64_t called_time = 0;
EXPECT_CALL(module, TimeUntilNextProcess())
.WillOnce(DoAll(SetTimestamp(&start_time),
Return(milliseconds)))
.WillOnce(DoAll(SetTimestamp(&start_time), Return(milliseconds)))
.WillRepeatedly(Return(milliseconds));
EXPECT_CALL(module, Process())
.WillOnce(DoAll(SetTimestamp(&called_time),
SetEvent(event.get()),
Return()))
.WillOnce(
DoAll(SetTimestamp(&called_time), SetEvent(event.get()), Return()))
.WillRepeatedly(Return());
EXPECT_CALL(module, ProcessThreadAttached(&thread)).Times(1);
@ -238,11 +235,9 @@ TEST(ProcessThreadImpl, DISABLED_Process50Times) {
MockModule module;
int callback_count = 0;
// Ask for a callback after 20ms.
EXPECT_CALL(module, TimeUntilNextProcess())
.WillRepeatedly(Return(20));
EXPECT_CALL(module, TimeUntilNextProcess()).WillRepeatedly(Return(20));
EXPECT_CALL(module, Process())
.WillRepeatedly(DoAll(Increment(&callback_count),
Return()));
.WillRepeatedly(DoAll(Increment(&callback_count), Return()));
EXPECT_CALL(module, ProcessThreadAttached(&thread)).Times(1);
thread.RegisterModule(&module, RTC_FROM_HERE);
@ -281,8 +276,7 @@ TEST(ProcessThreadImpl, WakeUp) {
// The second time TimeUntilNextProcess is then called, is after Process
// has been called and we don't expect any more calls.
EXPECT_CALL(module, TimeUntilNextProcess())
.WillOnce(DoAll(SetTimestamp(&start_time),
SetEvent(started.get()),
.WillOnce(DoAll(SetTimestamp(&start_time), SetEvent(started.get()),
Return(1000)))
.WillOnce(Return(1000));
EXPECT_CALL(module, Process())