Chromium Code Reviews
Descriptionandroid: Don't pass ScopedJavaGlobalRef pointers.
Various code was passing pointers to heap-allocated ScopedJavaGlobalRef
objects in order to pass Java objects between threads. Having
heap-allocated smart pointer types is very weird and not a desirable
pattern.
base::Bind handles rvalues correctly (they become owned by the callback)
and so the nicer alternative is to simply pass temporary
ScopedJavaGlobalRef parameters, which will automatically be deleted when
the callback is deleted. The receiving function can take a const
reference to JavaRef as its parameter type, which matches how direct
function calls typically take Java object parameters and makes this look
much more consistent.
ScopedJavaGlobalRef is movable, so using std::mode is also an option,
but all the cases in this CL simply construct temporaries.
BUG=519562
Committed: https://crrev.com/d2b4c5dac132d311691be5818b44f2abdf238749
Cr-Commit-Position: refs/heads/master@{#435593}
Patch Set 1 #Patch Set 2 : Reupload due to timeout #Patch Set 3 : Reupload #2 due to timeout :( #Patch Set 4 : timeouts are very annoying #Messages
Total messages: 12 (4 generated)
|