Commit ad16b40a authored by alexeypa@chromium.org's avatar alexeypa@chromium.org

Properly notify the handle verifier when a handle is passed around. This CL...

Properly notify the handle verifier when a handle is passed around. This CL fixes issues introduced by r150508.

BUG=134694


Review URL: https://chromiumcodereview.appspot.com/10855061

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150825 0039d316-1c4b-4281-b951-d872f2087c98
parent e50c6ad8
...@@ -49,7 +49,8 @@ class GenericScopedHandle { ...@@ -49,7 +49,8 @@ class GenericScopedHandle {
} }
// Move constructor for C++03 move emulation of this type. // Move constructor for C++03 move emulation of this type.
GenericScopedHandle(RValue& other) : handle_(other.Take()) { GenericScopedHandle(RValue& other) : handle_(Traits::NullHandle()) {
Set(other.Take());
} }
~GenericScopedHandle() { ~GenericScopedHandle() {
...@@ -62,9 +63,9 @@ class GenericScopedHandle { ...@@ -62,9 +63,9 @@ class GenericScopedHandle {
// Move operator= for C++03 move emulation of this type. // Move operator= for C++03 move emulation of this type.
GenericScopedHandle& operator=(RValue& other) { GenericScopedHandle& operator=(RValue& other) {
// Swapping the handles helps to avoid problems while assigning a handle if (this != &other) {
// to itself. It is also cheap and matches base::scoped_ptr behavior. Set(other.Take());
Swap(other); }
return *this; return *this;
} }
...@@ -97,12 +98,6 @@ class GenericScopedHandle { ...@@ -97,12 +98,6 @@ class GenericScopedHandle {
return &handle_; return &handle_;
} }
void Swap(GenericScopedHandle& other) {
Handle tmp = handle_;
handle_ = other.handle_;
other.handle_ = tmp;
}
// Transfers ownership away from this object. // Transfers ownership away from this object.
Handle Take() { Handle Take() {
Handle temp = handle_; Handle temp = handle_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment