Skip to content

Commit

Permalink
Deprecate SbUserGetSignedIn SB API (youtube#1211)
Browse files Browse the repository at this point in the history
b/271930936
  • Loading branch information
gbournou committed Aug 14, 2023
1 parent cc28287 commit c84aad9
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 22 deletions.
4 changes: 2 additions & 2 deletions cobalt/site/docs/reference/starboard/modules/event.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ the type of the value pointed to by that data argument, if any.
* `kSbEventTypeUser`

A user change event, which means a new user signed-in or signed-out, or the
current user changed. No data argument, call SbUserGetSignedIn() and
SbUserGetCurrent() to get the latest changes.
current user changed. No data argument, call SbUserGetCurrent() to get the
latest changes.
* `kSbEventTypeLink`

A navigational link has come from the system, and the application should
Expand Down
18 changes: 0 additions & 18 deletions cobalt/site/docs/reference/starboard/modules/user.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,24 +104,6 @@ The property for which the data is requested.
int SbUserGetPropertySize(SbUser user, SbUserPropertyId property_id)
```

### SbUserGetSignedIn ###

Gets a list of up to `users_size` signed-in users and places the results in
`out_users`. The return value identifies the actual number of signed-in users,
which may be greater or less than `users_size`.

It is expected that there will be a unique `SbUser` per signed-in user and that
the referenced objects will persist for the lifetime of the app.

`out_users`: Handles for the retrieved users. `users_size`: The maximum number
of signed-in users to retrieve.

#### Declaration ####

```
int SbUserGetSignedIn(SbUser *out_users, int users_size)
```

### SbUserIsValid ###

Returns whether the given user handle is valid.
Expand Down
3 changes: 3 additions & 0 deletions starboard/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ can be found in the comments of the "Experimental Feature Defines" section of

## Version 16

### Removed SbUserGetSignedIn
The API is no longer used and has been deprecated.

### Removed SbByteSwapS16, SbByteSwapS32, SbByteSwapS64, SbByteSwapU16, SbByteSwapU32, and SbByteSwapU64
The APIs defined in `starboard/byte_swap.h` are no longer used and have been
deprecated.
Expand Down
2 changes: 2 additions & 0 deletions starboard/elf_loader/exported_symbols.cc
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,9 @@ ExportedSymbols::ExportedSymbols() {
REGISTER_SYMBOL(SbUserGetCurrent);
REGISTER_SYMBOL(SbUserGetProperty);
REGISTER_SYMBOL(SbUserGetPropertySize);
#if SB_API_VERSION < 16
REGISTER_SYMBOL(SbUserGetSignedIn);
#endif
REGISTER_SYMBOL(SbWindowBlurOnScreenKeyboard);
REGISTER_SYMBOL(SbWindowCreate);
REGISTER_SYMBOL(SbWindowDestroy);
Expand Down
4 changes: 2 additions & 2 deletions starboard/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ typedef enum SbEventType {
kSbEventTypeInput,

// A user change event, which means a new user signed-in or signed-out, or the
// current user changed. No data argument, call SbUserGetSignedIn() and
// SbUserGetCurrent() to get the latest changes.
// current user changed. No data argument, call SbUserGetCurrent() to get the
// latest changes.
kSbEventTypeUser,

// A navigational link has come from the system, and the application should
Expand Down
11 changes: 11 additions & 0 deletions starboard/nplb/user_get_current_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ namespace starboard {
namespace nplb {
namespace {

#if SB_API_VERSION < 16

TEST(SbUserGetCurrentTest, SunnyDay) {
SbUser users[10] = {0};
int result = SbUserGetSignedIn(users, SB_ARRAY_SIZE_INT(users));
Expand All @@ -32,6 +34,15 @@ TEST(SbUserGetCurrentTest, SunnyDay) {
}
}

#else

TEST(SbUserGetCurrentTest, SunnyDay) {
SbUser current = SbUserGetCurrent();
EXPECT_NE(kSbUserInvalid, current);
}

#endif

} // namespace
} // namespace nplb
} // namespace starboard
4 changes: 4 additions & 0 deletions starboard/nplb/user_get_signed_in_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#if SB_API_VERSION < 16

#include "starboard/user.h"
#include "testing/gtest/include/gtest/gtest.h"

Expand Down Expand Up @@ -57,3 +59,5 @@ TEST(SbUserGetSignedInTest, NullUsers) {
} // namespace
} // namespace nplb
} // namespace starboard

#endif
4 changes: 4 additions & 0 deletions starboard/shared/nouser/user_get_signed_in.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#if SB_API_VERSION < 16

#include "starboard/user.h"

#include "starboard/shared/nouser/user_internal.h"
Expand All @@ -25,3 +27,5 @@ int SbUserGetSignedIn(SbUser* out_users, int users_size) {

return 1;
}

#endif
4 changes: 4 additions & 0 deletions starboard/shared/stub/user_get_signed_in.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#if SB_API_VERSION < 16

#include "starboard/user.h"

int SbUserGetSignedIn(SbUser* out_users, int users_size) {
return 0;
}

#endif
2 changes: 2 additions & 0 deletions starboard/user.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ static SB_C_INLINE bool SbUserIsValid(SbUser user) {
//
// |out_users|: Handles for the retrieved users.
// |users_size|: The maximum number of signed-in users to retrieve.
#if SB_API_VERSION < 16
SB_EXPORT int SbUserGetSignedIn(SbUser* out_users, int users_size);
#endif

// Gets the current primary user, if one exists. This is the user that is
// determined, in a platform-specific way, to be the primary user controlling
Expand Down

0 comments on commit c84aad9

Please sign in to comment.