Backed out 5 changesets (bug 1448428) for build bustages at SocketProcessParent.cpp. CLOSED TREE

Backed out changeset 192294c1413a (bug 1448428)
Backed out changeset da732f0c37d5 (bug 1448428)
Backed out changeset c48617a975e9 (bug 1448428)
Backed out changeset 92ca5adb7eb3 (bug 1448428)
Backed out changeset 3a3c734343f3 (bug 1448428)
This commit is contained in:
Razvan Maries 2020-05-13 02:20:24 +03:00
Родитель 123741c4e8
Коммит 2fe860484b
6 изменённых файлов: 75 добавлений и 278 удалений

Просмотреть файл

@ -37,7 +37,6 @@
#ifdef MOZ_WIDGET_ANDROID
# include "AndroidBridge.h"
# include "mozilla/java/HardwareCodecCapabilityUtilsWrappers.h"
#endif
struct JSContext;

Просмотреть файл

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/java/HardwareCodecCapabilityUtilsWrappers.h"
#include "GeneratedJNIWrappers.h"
#include "MediaInfo.h"
#include "OpusDecoder.h"
#include "RemoteDataDecoder.h"

Просмотреть файл

@ -19,13 +19,8 @@ import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.util.Arrays;
import java.util.Iterator;
import java.util.TreeSet;
public class AnnotationProcessor {
private static final String NATIVES_NAME = "Natives";
private static final String WRAPPERS_NAME = "Wrappers";
private static final String EXPORT_PREFIX = "mozilla/java/";
public static final String GENERATED_COMMENT =
"// GENERATED CODE\n" +
"// Generated by the Java program at /build/annotationProcessors at compile time\n" +
@ -34,6 +29,10 @@ public class AnnotationProcessor {
"// will cause your build to fail.\n" +
"\n";
private static final StringBuilder headerFile = new StringBuilder(GENERATED_COMMENT);
private static final StringBuilder implementationFile = new StringBuilder(GENERATED_COMMENT);
private static final StringBuilder nativesFile = new StringBuilder(GENERATED_COMMENT);
public static void main(String[] args) {
// We expect a list of jars on the commandline. If missing, whinge about it.
if (args.length < 2) {
@ -42,9 +41,9 @@ public class AnnotationProcessor {
}
final String OUTPUT_PREFIX = args[0];
final String QUALIFIER = OUTPUT_PREFIX + "JNI";
(new File(QUALIFIER)).mkdir();
final String SOURCE_FILE = OUTPUT_PREFIX + "JNIWrappers.cpp";
final String HEADER_FILE = OUTPUT_PREFIX + "JNIWrappers.h";
final String NATIVES_FILE = OUTPUT_PREFIX + "JNINatives.h";
System.out.println("Processing annotations...");
@ -56,182 +55,83 @@ public class AnnotationProcessor {
// Start the clock!
long s = System.currentTimeMillis();
int ret = 0;
final String unifiedHeaderFileName = QUALIFIER + WRAPPERS_NAME + ".h";
final String unifiedNativesFileName = QUALIFIER + NATIVES_NAME + ".h";
final StringBuilder unifiedHeaderFile = new StringBuilder(GENERATED_COMMENT);
final StringBuilder unifiedNativesFile = new StringBuilder(GENERATED_COMMENT);
// Class names that are included in the unified header. Eventually, all these class names
// will be removed from this list and the unified header files can be removed entirely.
final TreeSet<String> generatedNamesToUnify = new TreeSet<String>();
generatedNamesToUnify.add("AndroidGamepadManager");
generatedNamesToUnify.add("Base64Utils");
generatedNamesToUnify.add("Clipboard");
generatedNamesToUnify.add("CodecProxy");
generatedNamesToUnify.add("EventCallback");
generatedNamesToUnify.add("EventDispatcher");
generatedNamesToUnify.add("GeckoAppShell");
generatedNamesToUnify.add("GeckoAudioInfo");
generatedNamesToUnify.add("GeckoBatteryManager");
generatedNamesToUnify.add("GeckoBundle");
generatedNamesToUnify.add("GeckoEditableChild");
generatedNamesToUnify.add("GeckoHLSDemuxerWrapper");
generatedNamesToUnify.add("GeckoHLSResourceWrapper");
generatedNamesToUnify.add("GeckoHLSSample");
generatedNamesToUnify.add("GeckoInputStream");
generatedNamesToUnify.add("GeckoJavaSampler");
generatedNamesToUnify.add("GeckoNetworkManager");
generatedNamesToUnify.add("GeckoProcessManager");
generatedNamesToUnify.add("GeckoResult");
generatedNamesToUnify.add("GeckoRuntime");
generatedNamesToUnify.add("GeckoScreenOrientation");
generatedNamesToUnify.add("GeckoServiceChildProcess");
generatedNamesToUnify.add("GeckoSession");
generatedNamesToUnify.add("GeckoSurface");
generatedNamesToUnify.add("GeckoSurfaceTexture");
generatedNamesToUnify.add("GeckoSystemStateListener");
generatedNamesToUnify.add("GeckoThread");
generatedNamesToUnify.add("GeckoVRManager");
generatedNamesToUnify.add("GeckoVideoInfo");
generatedNamesToUnify.add("GeckoWebExecutor");
generatedNamesToUnify.add("ImageDecoder");
generatedNamesToUnify.add("MediaDrmProxy");
generatedNamesToUnify.add("PanZoomController");
generatedNamesToUnify.add("PrefsHelper");
generatedNamesToUnify.add("RuntimeTelemetry");
generatedNamesToUnify.add("Sample");
generatedNamesToUnify.add("SampleBuffer");
generatedNamesToUnify.add("ScreenManagerHelper");
generatedNamesToUnify.add("SessionAccessibility");
generatedNamesToUnify.add("SessionKeyInfo");
generatedNamesToUnify.add("SessionTextInput");
generatedNamesToUnify.add("SpeechSynthesisService");
generatedNamesToUnify.add("StackScroller");
generatedNamesToUnify.add("SurfaceAllocator");
generatedNamesToUnify.add("SurfaceTextureListener");
generatedNamesToUnify.add("TelemetryUtils");
generatedNamesToUnify.add("VsyncSource");
generatedNamesToUnify.add("WebAuthnTokenManager");
generatedNamesToUnify.add("WebMessage");
generatedNamesToUnify.add("WebNotification");
generatedNamesToUnify.add("WebNotificationDelegate");
generatedNamesToUnify.add("WebRequest");
generatedNamesToUnify.add("WebRequestError");
generatedNamesToUnify.add("WebResponse");
generatedNamesToUnify.add("XPCOMEventTarget");
// Get an iterator over the classes in the jar files given...
Iterator<ClassWithOptions> jarClassIterator = IterableJarLoadingURLClassLoader.getIteratorOverJars(jars);
headerFile.append(
"#ifndef " + getHeaderGuardName(HEADER_FILE) + "\n" +
"#define " + getHeaderGuardName(HEADER_FILE) + "\n" +
"\n" +
"#ifndef MOZ_PREPROCESSOR\n" +
"#include \"mozilla/jni/Refs.h\"\n" +
"#endif\n" +
"\n" +
"namespace mozilla {\n" +
"namespace java {\n" +
"\n");
implementationFile.append(
"#ifndef MOZ_PREPROCESSOR\n" +
"#include \"" + HEADER_FILE + "\"\n" +
"#include \"mozilla/jni/Accessors.h\"\n" +
"#endif\n" +
"\n" +
"namespace mozilla {\n" +
"namespace java {\n" +
"\n");
nativesFile.append(
"#ifndef " + getHeaderGuardName(NATIVES_FILE) + "\n" +
"#define " + getHeaderGuardName(NATIVES_FILE) + "\n" +
"\n" +
"#ifndef MOZ_PREPROCESSOR\n" +
"#include \"" + HEADER_FILE + "\"\n" +
"#include \"mozilla/jni/Natives.h\"\n" +
"#endif\n" +
"\n" +
"namespace mozilla {\n" +
"namespace java {\n" +
"\n");
while (jarClassIterator.hasNext()) {
final ClassWithOptions annotatedClass = jarClassIterator.next();
if (!annotatedClass.hasGenerated()) {
continue;
}
final String sourceFileName = QUALIFIER + annotatedClass.generatedName + WRAPPERS_NAME + ".cpp";
final String headerFileName = QUALIFIER + File.separator + annotatedClass.generatedName + WRAPPERS_NAME + ".h";
final String headerExportedFileName = EXPORT_PREFIX + annotatedClass.generatedName + WRAPPERS_NAME + ".h";
final String nativesFileName = QUALIFIER + File.separator + annotatedClass.generatedName + NATIVES_NAME + ".h";
final String nativesExportedFileName = EXPORT_PREFIX + annotatedClass.generatedName + NATIVES_NAME + ".h";
if (generatedNamesToUnify.contains(annotatedClass.generatedName)) {
unifiedHeaderFile.append("#include \"" + headerExportedFileName + "\"\n");
unifiedNativesFile.append("#include \"" + nativesExportedFileName + "\"\n");
}
generatedNamesToUnify.remove(annotatedClass.generatedName);
final StringBuilder headerFile = new StringBuilder(GENERATED_COMMENT);
final StringBuilder implementationFile = new StringBuilder(GENERATED_COMMENT);
final StringBuilder nativesFile = new StringBuilder(GENERATED_COMMENT);
headerFile.append(
"#ifndef " + getHeaderGuardName(headerExportedFileName) + "\n" +
"#define " + getHeaderGuardName(headerExportedFileName) + "\n" +
"\n" +
"#ifndef MOZ_PREPROCESSOR\n" +
"#include \"mozilla/jni/Refs.h\"\n" +
"#endif\n" +
"\n" +
"namespace mozilla {\n" +
"namespace java {\n" +
"\n");
implementationFile.append(
"#ifndef MOZ_PREPROCESSOR\n" +
"#include \"" + headerExportedFileName + "\"\n" +
"#include \"mozilla/jni/Accessors.h\"\n" +
"#endif\n" +
"\n" +
"namespace mozilla {\n" +
"namespace java {\n" +
"\n");
nativesFile.append(
"#ifndef " + getHeaderGuardName(nativesExportedFileName) + "\n" +
"#define " + getHeaderGuardName(nativesExportedFileName) + "\n" +
"\n" +
"#ifndef MOZ_PREPROCESSOR\n" +
"#include \"" + headerExportedFileName + "\"\n" +
"#include \"mozilla/jni/Natives.h\"\n" +
"#endif\n" +
"\n" +
"namespace mozilla {\n" +
"namespace java {\n" +
"\n");
generateClass(annotatedClass, headerFile, implementationFile, nativesFile);
implementationFile.append(
"} /* java */\n" +
"} /* mozilla */\n");
headerFile.append(
"} /* java */\n" +
"} /* mozilla */\n" +
"#endif // " + getHeaderGuardName(headerFileName) + "\n");
nativesFile.append(
"} /* java */\n" +
"} /* mozilla */\n" +
"#endif // " + getHeaderGuardName(nativesFileName) + "\n");
ret |= writeOutputFile(sourceFileName, implementationFile);
ret |= writeOutputFile(headerFileName, headerFile);
ret |= writeOutputFile(nativesFileName, nativesFile);
generateClass(jarClassIterator.next());
}
ret |= writeOutputFile(unifiedHeaderFileName, unifiedHeaderFile);
ret |= writeOutputFile(unifiedNativesFileName, unifiedNativesFile);
implementationFile.append(
"} /* java */\n" +
"} /* mozilla */\n");
headerFile.append(
"} /* java */\n" +
"} /* mozilla */\n" +
"#endif // " + getHeaderGuardName(HEADER_FILE) + "\n");
nativesFile.append(
"} /* java */\n" +
"} /* mozilla */\n" +
"#endif // " + getHeaderGuardName(NATIVES_FILE) + "\n");
int ret = 0;
ret |= writeOutputFile(SOURCE_FILE, implementationFile);
ret |= writeOutputFile(HEADER_FILE, headerFile);
ret |= writeOutputFile(NATIVES_FILE, nativesFile);
long e = System.currentTimeMillis();
System.out.println("Annotation processing complete in " + (e - s) + "ms");
if (!generatedNamesToUnify.isEmpty()) {
System.out.println(
"Some unified annotation header names need to be updated; edit " +
"mobile/android/annotations/src/main/java/org/mozilla/gecko/annotationProcessors/annotationProcessor.java:");
for (String n : generatedNamesToUnify) {
System.out.println(n);
}
ret = 2;
}
System.exit(ret);
}
private static void generateClass(final ClassWithOptions annotatedClass,
final StringBuilder headerFile,
final StringBuilder implementationFile,
final StringBuilder nativesFile) {
private static void generateClass(final ClassWithOptions annotatedClass) {
// Get an iterator over the appropriately generated methods of this class
final GeneratableElementIterator methodIterator
= new GeneratableElementIterator(annotatedClass);
final ClassWithOptions[] innerClasses = methodIterator.getInnerClasses();
if (!methodIterator.hasNext() && innerClasses.length == 0) {
return;
}
final CodeGenerator generatorInstance = new CodeGenerator(annotatedClass);
generatorInstance.generateClasses(innerClasses);
@ -259,7 +159,7 @@ public class AnnotationProcessor {
nativesFile.append(generatorInstance.getNativesFileContents());
for (ClassWithOptions innerClass : innerClasses) {
generateClass(innerClass, headerFile, implementationFile, nativesFile);
generateClass(innerClass);
}
}

Просмотреть файл

@ -4,8 +4,6 @@
package org.mozilla.gecko.annotationProcessors.classloader;
import org.mozilla.gecko.annotationProcessors.utils.GeneratableElementIterator;
public class ClassWithOptions {
public final Class<?> wrappedClass;
public final String generatedName;
@ -16,22 +14,4 @@ public class ClassWithOptions {
generatedName = name;
this.ifdef = ifdef;
}
public boolean hasGenerated() {
final GeneratableElementIterator methodIterator
= new GeneratableElementIterator(this);
if (methodIterator.hasNext()) {
return true;
}
final ClassWithOptions[] innerClasses = methodIterator.getInnerClasses();
for (ClassWithOptions innerClass : innerClasses) {
if (innerClass.hasGenerated()) {
return true;
}
}
return false;
}
}

Просмотреть файл

@ -44,7 +44,6 @@
#include "WidgetUtils.h"
#include "GeneratedJNIWrappers.h"
#include "mozilla/java/HardwareCodecCapabilityUtilsWrappers.h"
using namespace mozilla;
using namespace mozilla::gfx;

Просмотреть файл

@ -26,74 +26,11 @@ EXPORTS += [
'AndroidBridge.h',
]
classes_with_WrapForJNI = [
'AndroidGamepadManager',
'Base64Utils',
'Clipboard',
'CodecProxy',
'EventCallback',
'EventDispatcher',
'GeckoAppShell',
'GeckoAudioInfo',
'GeckoBatteryManager',
'GeckoBundle',
'GeckoEditableChild',
'GeckoHLSDemuxerWrapper',
'GeckoHLSResourceWrapper',
'GeckoHLSSample',
'GeckoInputStream',
'GeckoJavaSampler',
'GeckoNetworkManager',
'GeckoProcessManager',
'GeckoResult',
'GeckoRuntime',
'GeckoScreenOrientation',
'GeckoServiceChildProcess',
'GeckoSession',
'GeckoSurface',
'GeckoSurfaceTexture',
'GeckoSystemStateListener',
'GeckoThread',
'GeckoVRManager',
'GeckoVideoInfo',
'GeckoWebExecutor',
'HardwareCodecCapabilityUtils',
'ImageDecoder',
'MediaDrmProxy',
'PanZoomController',
'PrefsHelper',
'RuntimeTelemetry',
'Sample',
'SampleBuffer',
'ScreenManagerHelper',
'SessionAccessibility',
'SessionKeyInfo',
'SessionTextInput',
'SpeechSynthesisService',
'StackScroller',
'SurfaceAllocator',
'SurfaceTextureListener',
'TelemetryUtils',
'VsyncSource',
'WebAuthnTokenManager',
'WebMessage',
'WebNotification',
'WebNotificationDelegate',
'WebRequest',
'WebRequestError',
'WebResponse',
'XPCOMEventTarget',
EXPORTS += [
'!GeneratedJNINatives.h',
'!GeneratedJNIWrappers.h',
]
natives_from_WrapForJNI = sorted(
['GeneratedJNI/{}Natives.h'.format(c) for c in classes_with_WrapForJNI])
wrappers_from_WrapForJNI = sorted(
['GeneratedJNI/{}Wrappers.h'.format(c) for c in classes_with_WrapForJNI])
sources_from_WrapForJNI = sorted(
'GeneratedJNI{}Wrappers.cpp'.format(c) for c in classes_with_WrapForJNI)
EXPORTS.mozilla.widget += [
'AndroidCompositorWidget.h',
'AndroidUiThread.h',
@ -101,22 +38,8 @@ EXPORTS.mozilla.widget += [
'nsWindow.h',
]
EXPORTS.mozilla.java += [
'!{}'.format(c) for c in natives_from_WrapForJNI
]
EXPORTS.mozilla.java += [
'!{}'.format(c) for c in wrappers_from_WrapForJNI
]
EXPORTS += [
'!GeneratedJNINatives.h',
'!GeneratedJNIWrappers.h',
]
SOURCES += ['!{}'.format(c) for c in sources_from_WrapForJNI]
SOURCES += [
'!GeneratedJNIWrappers.cpp',
'MediaKeysEventSourceFactory.cpp',
]
@ -156,13 +79,9 @@ include('/ipc/chromium/chromium-config.mozbuild')
# an open FileAvoidWrite to the invoked script. That doesn't work well with
# the Gradle task that generates all of the outputs, so we add a dummy first
# output.
t = tuple(['generated_jni_wrappers', 'GeneratedJNINatives.h',
'GeneratedJNIWrappers.h'] + natives_from_WrapForJNI +
sources_from_WrapForJNI + wrappers_from_WrapForJNI)
GeneratedFile(*t,
script='/mobile/android/gradle.py',
GeneratedFile(
'generated_jni_wrappers', 'GeneratedJNINatives.h', 'GeneratedJNIWrappers.h',
'GeneratedJNIWrappers.cpp', script='/mobile/android/gradle.py',
entry_point='generate_generated_jni_wrappers')
FINAL_LIBRARY = 'xul'