Skip to content

Get rid of more firebase::Log* calls, to help with objc initialization. #822

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions app/src/util_ios.mm
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ void RunOnBackgroundThread(void (*function_ptr)(void *function_data), void *func
// implements a stub for the method).
const char *type_encoding =
method_getTypeEncoding(class_getInstanceMethod(type_encoding_class, name));
FIREBASE_ASSERT(type_encoding);
assert(type_encoding);

NSString *new_method_name_nsstring = nil;
if (GetLogLevel() <= kLogLevelDebug) {
Expand Down Expand Up @@ -397,7 +397,9 @@ void RunOnBackgroundThread(void (*function_ptr)(void *function_data), void *func
selector_implementation_names_per_selector_[selector_name_nsstring];
const char *class_name = class_getName(clazz);
if (!selector_implementation_names) {
firebase::LogDebug("Method not cached for class %s selector %s.", class_name, selector_name);
if (GetLogLevel() <= kLogLevelDebug) {
NSLog(@"Method not cached for class %s selector %s.", class_name, selector_name);
}
return nil;
}

Expand All @@ -415,23 +417,29 @@ void RunOnBackgroundThread(void (*function_ptr)(void *function_data), void *func
search_class = clazz;
for (; search_class; search_class = class_getSuperclass(search_class)) {
const char *search_class_name = class_getName(search_class);
firebase::LogDebug("Searching for selector %s (%s) on class %s", selector_name,
selector_implementation_name, search_class_name);
if (GetLogLevel() <= kLogLevelDebug) {
NSLog(@"Searching for selector %s (%s) on class %s", selector_name,
selector_implementation_name, search_class_name);
}
Method method = class_getInstanceMethod(search_class, selector_implementation);
method_implementation = method ? method_getImplementation(method) : nil;
if (method_implementation) break;
}
if (method_implementation) break;
}
if (!method_implementation) {
firebase::LogDebug("Class %s does not respond to selector %s (%s)", class_name, selector_name,
selector_implementation_name_nsstring.UTF8String);
if (GetLogLevel() <= kLogLevelDebug) {
NSLog(@"Class %s does not respond to selector %s (%s)", class_name, selector_name,
selector_implementation_name_nsstring.UTF8String);
}
return nil;
}
firebase::LogDebug("Found %s (%s, 0x%08x) on class %s (%s)", selector_name,
selector_implementation_name_nsstring.UTF8String,
static_cast<int>(reinterpret_cast<intptr_t>(method_implementation)),
class_name, class_getName(search_class));
if (GetLogLevel() <= kLogLevelDebug) {
NSLog(@"Found %s (%s, 0x%08x) on class %s (%s)", selector_name,
selector_implementation_name_nsstring.UTF8String,
static_cast<int>(reinterpret_cast<intptr_t>(method_implementation)), class_name,
class_getName(search_class));
}
return method_implementation;
}

Expand Down