Commit d0d0b53a authored by Mohamed Heikal's avatar Mohamed Heikal Committed by Commit Bot

Allow NativeBackgrounTask to start in ServiceManagerOnly mode

NativeBackgroundTask now allows subclasses to indicate if they support
lite mode. If they do, the EmptyBrowserParts that it creates would also
signal the same to native.

Bug: 913480
Change-Id: I85bf27e9edd5b01cee7756c7a951cd95d3e9520e
Reviewed-on: https://chromium-review.googlesource.com/c/1370580Reviewed-by: default avatarYaron Friedman <yfriedman@chromium.org>
Reviewed-by: default avatarXi Han <hanxi@chromium.org>
Commit-Queue: Mohamed Heikal <mheikal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#615932}
parent 89a9f8ca
...@@ -108,6 +108,10 @@ public abstract class NativeBackgroundTask implements BackgroundTask { ...@@ -108,6 +108,10 @@ public abstract class NativeBackgroundTask implements BackgroundTask {
ThreadUtils.postOnUiThread(startWithNativeRunnable); ThreadUtils.postOnUiThread(startWithNativeRunnable);
} }
@Override @Override
public boolean startServiceManagerOnly() {
return supportsServiceManagerOnly();
}
@Override
public void onStartupFailure() { public void onStartupFailure() {
ThreadUtils.postOnUiThread(rescheduleRunnable); ThreadUtils.postOnUiThread(rescheduleRunnable);
} }
...@@ -134,6 +138,19 @@ public abstract class NativeBackgroundTask implements BackgroundTask { ...@@ -134,6 +138,19 @@ public abstract class NativeBackgroundTask implements BackgroundTask {
}); });
} }
/**
* Descendant classes should override this method if they support running in service manager
* only mode.
*
* TODO(https://crbug.com/913480): implement in a subclass once it can support running in
* ServiceManager only mode.
*
* @return if the task supports running in service manager only mode.
*/
protected boolean supportsServiceManagerOnly() {
return false;
}
/** /**
* Method that should be implemented in derived classes to provide implementation of {@link * Method that should be implemented in derived classes to provide implementation of {@link
* BackgroundTask#onStartTask(Context, TaskParameters, TaskFinishedCallback)} run before native * BackgroundTask#onStartTask(Context, TaskParameters, TaskFinishedCallback)} run before native
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment