Skip to content

Commit

Permalink
8240264: iOS: Unnecessary logging on every pulse when GL context changes
Browse files Browse the repository at this point in the history
Reviewed-by: kcr, jvos
  • Loading branch information
Jose Pereda committed Jun 29, 2020
1 parent 2ca509a commit 15f97ed
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,26 @@
#include "com_sun_prism_es2_IOSGLContext.h"

extern void printAndReleaseResources(jlong pf, jlong ctx, const char *message);
jboolean pulseLoggingRequested;

jboolean isPulseLoggingRequested(JNIEnv *env) {
jclass loggerCls = (*env)->FindClass(env, "com/sun/javafx/logging/PulseLogger");
if ((*env)->ExceptionCheck(env) || loggerCls == NULL) {
(*env)->ExceptionClear(env);
return JNI_FALSE;
}
jmethodID loggerMID = (*env)->GetStaticMethodID(env, loggerCls, "isPulseLoggingRequested", "()Z");
if ((*env)->ExceptionCheck(env) || loggerMID == NULL) {
(*env)->ExceptionClear(env);
return JNI_FALSE;
}
jboolean result = (*env)->CallStaticBooleanMethod(env, loggerCls, loggerMID);
if ((*env)->ExceptionCheck(env)) {
(*env)->ExceptionClear(env);
return JNI_FALSE;
}
return result;
}

/*
* Class: com_sun_prism_es2_IOSGLContext
Expand All @@ -51,6 +71,7 @@ JNIEXPORT jlong JNICALL Java_com_sun_prism_es2_IOSGLContext_nInitialize
int versionNumbers[2];
const char *glExtensions;

pulseLoggingRequested = isPulseLoggingRequested(env);
jlong pixelFormat = 0;
jlong win = 0;
jlong context = 0;
Expand Down Expand Up @@ -289,5 +310,7 @@ JNIEXPORT void JNICALL Java_com_sun_prism_es2_IOSGLContext_nMakeCurrent
interval = (vSyncNeeded) ? 1 : 0;
ctxInfo->state.vSyncEnabled = vSyncNeeded;
setSwapInterval(ctxInfo->context, interval);
fprintf(stderr, "setSwapInterval(%d)\n", interval);
if (pulseLoggingRequested) {
fprintf(stderr, "setSwapInterval(%d)\n", interval);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ jboolean flushBuffer(void *context) {
}

void setSwapInterval(void *context, int interval) {
fprintf(stderr, "IOSWindowSystemInterface : setSwapInterval unimp\n");
if (pulseLoggingRequested) {
fprintf(stderr, "IOSWindowSystemInterface : setSwapInterval unimp\n");
}
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ void* getProcAddress(const char *procName);

void setSwapInterval(void* nsContext, int interval);

extern jboolean pulseLoggingRequested;

0 comments on commit 15f97ed

Please sign in to comment.