diff options
author | Tobias Thierer <tobiast@google.com> | 2018-10-31 16:55:08 +0000 |
---|---|---|
committer | Tobias Thierer <tobiast@google.com> | 2020-03-23 11:34:32 +0000 |
commit | eb461e209030f9ad44662f41dd418f11efd35d83 (patch) | |
tree | d5c5c53691dd208d4f5f29c73422288672cc215e /tools/aapt2/java/JavaClassGenerator_test.cpp | |
parent | 97b74aa79fa19dec686728893a626e12cf3e10fb (diff) |
Refactor Network's use of mUrlConnectionFactory.
1.) Replace maybeInitUrlConnectionFactory() with a static method
createUrlConnectionFactory(Dns) and move the logic to acquire
the lock and initialize mUrlConnectionFactory out into
openConnection. This makes it a bit clearer that the lock
is acquired during openConnection().
2.) Use @GuardedBy("mLock") rather than a human readable comment
on mUrlConnectionFactory.
3.) Make mUrlConnectionFactory non-volatile (since it's guarded by
mLock), as recommended by Narayan on the review thread for
http://r.android.com/370652
Alternatively, the field could have remained volatile
and we could have used double-checked locking to avoid
acquiring the lock in the common case.
The lock is only acquired during getSocketFactory() and
openConnection(), so it shouldn't usually be contended.
This CL is a pure refactoring that shouldn't have any observable
behavior change.
Bug: 38311512
Test: Treehugger
Exempt-From-Owner-Approval: refactoring only, owner didn't respond in time
Change-Id: I1cf6075dc7cd994657b11d6a82de3ec63235fb1e
Diffstat (limited to 'tools/aapt2/java/JavaClassGenerator_test.cpp')
0 files changed, 0 insertions, 0 deletions