Closed
Bug 1343027
Opened 7 years ago
Closed 7 years ago
Add JNI wrappers for casting and locking
Categories
(Core Graveyard :: Widget: Android, defect)
Tracking
(firefox55 fixed)
RESOLVED
FIXED
mozilla55
Tracking | Status | |
---|---|---|
firefox55 | --- | fixed |
People
(Reporter: jchen, Assigned: jchen)
Details
Attachments
(2 files)
1.40 KB,
patch
|
snorp
:
review+
|
Details | Diff | Splinter Review |
3.57 KB,
patch
|
snorp
:
review+
|
Details | Diff | Splinter Review |
Add wrappers for casting one type to another type, and for locking an object.
Assignee | ||
Comment 1•7 years ago
|
||
Add a Cast function to jni::Ref to cast a reference to a different type (e.g. if ref is a jni::Object::Ref referring to a String instance, use | ref.Cast<jni::String>()->Length() | to get the length of the string). In MOZ_CHECK_JNI builds, Cast() checks that an instance of the source class can indeed be cast to the target class.
Attachment #8842204 -
Flags: review?(snorp)
Assignee | ||
Comment 2•7 years ago
|
||
Add a Lock function to jni::Ref to lock the referenced object akin to the synchronized keyword in Java. It returns a Locked RAII object that automatically unlocks the object when going out of scope.
Attachment #8842205 -
Flags: review?(snorp)
Comment on attachment 8842204 [details] [diff] [review] 1. Add jni::Ref::Cast function (v1) Review of attachment 8842204 [details] [diff] [review]: ----------------------------------------------------------------- This is super nice.
Attachment #8842204 -
Flags: review?(snorp) → review+
Comment on attachment 8842205 [details] [diff] [review] 2. Add jni::Ref::Lock function (v1) Review of attachment 8842205 [details] [diff] [review]: ----------------------------------------------------------------- ::: widget/android/jni/Refs.h @@ +78,5 @@ > > public: > using JNIType = Type; > > + class Locked AutoLock? AutoMonitor? AutoMutex? It should have Auto in it.
Attachment #8842205 -
Flags: review?(snorp) → review+
Pushed by nchen@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/a97e11f9a6e2 1. Add jni::Ref::Cast function; r=snorp https://hg.mozilla.org/integration/mozilla-inbound/rev/1af35d88e88b 2. Add jni::Ref::Lock function; r=snorp
Comment 6•7 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/a97e11f9a6e2 https://hg.mozilla.org/mozilla-central/rev/1af35d88e88b
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
status-firefox55:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Updated•3 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•