Bug 1517846 - Add missing docs for GeckoView.releaseSession() r=geckoview-reviewers,esawin#geckoview-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D15753

--HG--
extra : moz-landing-system : lando
This commit is contained in:
James Willcox 2019-01-15 19:13:33 +00:00
Родитель d9f0d9841b
Коммит 591b4ba931
3 изменённых файлов: 23 добавлений и 4 удалений

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

@ -705,9 +705,9 @@ package org.mozilla.geckoview {
method @android.support.annotation.AnyThread @android.support.annotation.NonNull public org.mozilla.gecko.EventDispatcher getEventDispatcher();
method @android.support.annotation.NonNull public org.mozilla.geckoview.PanZoomController getPanZoomController();
method @android.support.annotation.AnyThread @android.support.annotation.Nullable public org.mozilla.geckoview.GeckoSession getSession();
method @android.support.annotation.Nullable public org.mozilla.geckoview.GeckoSession releaseSession();
method public void setSession(@android.support.annotation.NonNull org.mozilla.geckoview.GeckoSession);
method public void setSession(@android.support.annotation.NonNull org.mozilla.geckoview.GeckoSession, @android.support.annotation.Nullable org.mozilla.geckoview.GeckoRuntime);
method @android.support.annotation.UiThread @android.support.annotation.Nullable public org.mozilla.geckoview.GeckoSession releaseSession();
method @android.support.annotation.UiThread public void setSession(@android.support.annotation.NonNull org.mozilla.geckoview.GeckoSession);
method @android.support.annotation.UiThread public void setSession(@android.support.annotation.NonNull org.mozilla.geckoview.GeckoSession, @android.support.annotation.Nullable org.mozilla.geckoview.GeckoRuntime);
method public boolean shouldPinOnScreen();
field protected final org.mozilla.geckoview.GeckoView.Display mDisplay;
field protected org.mozilla.geckoview.GeckoRuntime mRuntime;

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

@ -242,6 +242,14 @@ public class GeckoView extends FrameLayout {
}
}
/**
* Unsets the current session from this instance and returns it, if any. You must call
* this before {@link #setSession(GeckoSession)} if there is already an open session
* set for this instance.
*
* @return The {@link GeckoSession} that was set for this instance. May be null.
*/
@UiThread
public @Nullable GeckoSession releaseSession() {
ThreadUtils.assertOnUiThread();
@ -279,10 +287,14 @@ public class GeckoView extends FrameLayout {
/**
* Attach a session to this view. The session should be opened before
* attaching.
* attaching. If this instance already has an open session, you must use
* {@link #releaseSession()} first, otherwise {@link IllegalStateException}
* will be thrown. This is to avoid potentially leaking the currently opened session.
*
* @param session The session to be attached.
* @throws IllegalArgumentException if an existing open session is already set.
*/
@UiThread
public void setSession(@NonNull final GeckoSession session) {
ThreadUtils.assertOnUiThread();
@ -296,10 +308,15 @@ public class GeckoView extends FrameLayout {
/**
* Attach a session to this view. The session should be opened before
* attaching or a runtime needs to be provided for automatic opening.
* If this instance already has an open session, you must use
* {@link #releaseSession()} first, otherwise {@link IllegalStateException}
* will be thrown. This is to avoid potentially leaking the currently opened session.
*
* @param session The session to be attached.
* @param runtime The runtime to be used for opening the session.
* @throws IllegalArgumentException if an existing open session is already set.
*/
@UiThread
public void setSession(@NonNull final GeckoSession session,
@Nullable final GeckoRuntime runtime) {
ThreadUtils.assertOnUiThread();

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

@ -21,6 +21,8 @@ layout: geckoview
- Added GeckoRuntimeSetting for enabling desktop viewport. Desktop viewport is
no longer set by `USER_AGENT_MODE_DESKTOP` and must be set separately.
- Added `@UiThread` to `GeckoSession.releaseSession` and `GeckoSession.setSession`
## v65
- Moved [`CompositorController`][65.1], [`DynamicToolbarAnimator`][65.2],
[`OverscrollEdgeEffect`][65.3], [`PanZoomController`][65.4] from