commit | 1fd547a90acc75c995d8ec901ba52879558a27ae | [log] [tgz] |
---|---|---|
author | droger <[email protected]> | Tue Mar 17 15:13:08 2015 |
committer | Commit bot <[email protected]> | Tue Mar 17 15:13:54 2015 |
tree | 67aa1e718b8995cbd44697b0fc5adc4410ac5572 | |
parent | 18fd3fcfe4bf9d695d582c0b55a16039d57023fa [diff] [blame] |
[iOS] WeakNSObject assignment is consistent with copy constructor The copy constructor was changed (in CL https://codereview.chromium.org/853503002/) to allow a WeakNSObject to be copied on a different thread. This CL is making the assignment operator behave consistently with the copy constructor: it is now allowed to assign a WeakNSObject on a different thread. In any case, dereferencing the WeakNSObject on another thread remains disallowed. BUG=394008 Review URL: https://codereview.chromium.org/1014813002 Cr-Commit-Position: refs/heads/master@{#320915}
diff --git a/base/ios/weak_nsobject.h b/base/ios/weak_nsobject.h index a1984bb..fc3a7c3 100644 --- a/base/ios/weak_nsobject.h +++ b/base/ios/weak_nsobject.h
@@ -117,7 +117,9 @@ } WeakNSProtocol& operator=(const WeakNSProtocol<NST>& that) { - DCHECK(checker_.CalledOnValidThread()); + // A WeakNSProtocol object can be copied on one thread and used on + // another. + checker_.DetachFromThread(); container_ = that.container_; return *this; }