Skip to content

Commit

Permalink
Backed out 3 changesets (bug 1620145) for toolchains bustage complain…
Browse files Browse the repository at this point in the history
…ing about SelectionActionDelegateTest.kt CLOSED TREE

Backed out changeset 4614b6ccb155 (bug 1620145)
Backed out changeset 72d548277bd9 (bug 1620145)
Backed out changeset 4f3ee911b5c7 (bug 1620145)
  • Loading branch information
bogdant-old committed Mar 27, 2020
1 parent 3c2a43e commit 2a170da
Show file tree
Hide file tree
Showing 6 changed files with 189 additions and 391 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ allprojects {
topsrcdir = gradle.mozconfig.topsrcdir
topobjdir = gradle.mozconfig.topobjdir

compileSdkVersion = tryInt(mozconfig.substs.ANDROID_TARGET_SDK)
compileSdkVersion = 28
targetSdkVersion = tryInt(mozconfig.substs.ANDROID_TARGET_SDK)
minSdkVersion = tryInt(mozconfig.substs.MOZ_ANDROID_MIN_SDK_VERSION)
manifestPlaceholders = [
Expand Down
60 changes: 0 additions & 60 deletions hal/android/AndroidProcessPriority.cpp

This file was deleted.

2 changes: 1 addition & 1 deletion hal/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
'/widget/android',
]
UNIFIED_SOURCES += [
'android/AndroidProcessPriority.cpp',
'android/AndroidSensor.cpp',
'fallback/FallbackProcessPriority.cpp',
]
# AndroidHal.cpp cannot be built in unified mode because it relies on HalImpl.h.
SOURCES += [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ public ChildConnection(@NonNull final ServiceAllocator allocator,
mPid = INVALID_PID;
}

public ChildConnection(@NonNull final ServiceAllocator allocator,
@NonNull final GeckoProcessType type) {
this(allocator, type, PriorityLevel.FOREGROUND);
}

public int getPid() throws RemoteException {
XPCOMEventTarget.assertOnLauncherThread();
if (mChild == null) {
Expand Down Expand Up @@ -210,7 +215,7 @@ public GeckoResult<Void> unbind() {
// This could end up using IPC, so do it before we unbind.
final int pid = getPidFallible();

unbindService();
doUnbind();

if (pid != INVALID_PID) {
Process.killProcess(pid);
Expand All @@ -219,6 +224,24 @@ public GeckoResult<Void> unbind() {
return GeckoResult.fromValue(null);
}

private void clearConnectionInfo() {
// NB: This must happen *before* resetting mPid!
GeckoProcessManager.INSTANCE.mConnections.removeConnection(this);

mChild = null;
mPid = INVALID_PID;
}

private void doUnbind() {
try {
unbindService();
} catch (IllegalArgumentException e) {
// The binding was already dead. That's okay.
} finally {
clearConnectionInfo();
}
}

@Override
protected void onBinderConnected(final IBinder service) {
XPCOMEventTarget.assertOnLauncherThread();
Expand All @@ -233,12 +256,13 @@ protected void onBinderConnected(final IBinder service) {
}

@Override
protected void onReleaseResources() {
// NB: This must happen *before* resetting mPid!
GeckoProcessManager.INSTANCE.mConnections.removeConnection(this);
protected void onBinderConnectionLost() {
XPCOMEventTarget.assertOnLauncherThread();

mChild = null;
mPid = INVALID_PID;
// The binding has lost its connection, but the binding itself might still be active.
// Gecko itself will request a process restart, so here we attempt to unbind so that
// Android does not try to automatically restart and reconnect the service.
doUnbind();
}
}

Expand Down Expand Up @@ -351,12 +375,11 @@ private ChildConnection getContentConnectionForStart() {
XPCOMEventTarget.assertOnLauncherThread();

if (mNonStartedContentConnections.isEmpty()) {
// Initially start at BACKGROUND; Gecko will adjust as necessary.
return getNewContentConnection(PriorityLevel.BACKGROUND);
// Only FOREGROUND supported right now
return getNewContentConnection(PriorityLevel.FOREGROUND);
}

final ChildConnection conn = mNonStartedContentConnections.removeAt(mNonStartedContentConnections.size() - 1);
return conn;
return mNonStartedContentConnections.removeAt(mNonStartedContentConnections.size() - 1);
}

/**
Expand All @@ -370,7 +393,7 @@ private ChildConnection getNonContentConnection(@NonNull final GeckoProcessType

ChildConnection connection = mNonContentConnections.get(type);
if (connection == null) {
connection = new ChildConnection(mServiceAllocator, type, PriorityLevel.FOREGROUND);
connection = new ChildConnection(mServiceAllocator, type);
mNonContentConnections.put(type, connection);
}
return connection;
Expand All @@ -392,7 +415,7 @@ public ChildConnection getConnectionForStart(@NonNull final GeckoProcessType typ
*/
public ChildConnection getConnectionForPreload(@NonNull final GeckoProcessType type) {
if (type == GeckoProcessType.CONTENT) {
final ChildConnection conn = getNewContentConnection(PriorityLevel.BACKGROUND);
final ChildConnection conn = getNewContentConnection(PriorityLevel.FOREGROUND);
mNonStartedContentConnections.add(conn);
return conn;
}
Expand Down Expand Up @@ -450,20 +473,6 @@ private static void markAsDead(final Selector selector) {
conn.unbind();
}

@WrapForJNI
private static void setProcessPriority(@NonNull final Selector selector,
@NonNull final PriorityLevel priorityLevel,
final int relativeImportance) {
XPCOMEventTarget.runOnLauncherThread(() -> {
final ChildConnection conn = INSTANCE.mConnections.getExistingConnection(selector);
if (conn == null) {
return;
}

conn.setPriorityLevel(priorityLevel, relativeImportance);
});
}

@WrapForJNI
private static GeckoResult<Integer> start(final GeckoProcessType type,
final String[] args,
Expand Down
Loading

0 comments on commit 2a170da

Please sign in to comment.