Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Side by Side Diff: src/vm/refcounted.h

Issue 1405293007: Bugfix in process handle: Do detaching from owner process separately from derefing. (Closed) Base URL: git@github.com:dart-lang/fletch.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« src/vm/process_handle.h ('K') | « src/vm/process_handle.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Fletch project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Fletch project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE.md file. 3 // BSD-style license that can be found in the LICENSE.md file.
4 4
5 #ifndef SRC_VM_REFCOUNTED_H_ 5 #ifndef SRC_VM_REFCOUNTED_H_
6 #define SRC_VM_REFCOUNTED_H_ 6 #define SRC_VM_REFCOUNTED_H_
7 7
8 #include "src/shared/globals.h" 8 #include "src/shared/globals.h"
9 #include "src/shared/atomic.h" 9 #include "src/shared/atomic.h"
10 10
(...skipping 12 matching lines...) Expand all
23 ref_count_++; 23 ref_count_++;
24 } 24 }
25 25
26 static void DecrementRef(T* object) { 26 static void DecrementRef(T* object) {
27 ASSERT(object->ref_count_ > 0); 27 ASSERT(object->ref_count_ > 0);
28 if (--object->ref_count_ == 0) { 28 if (--object->ref_count_ == 0) {
29 delete reinterpret_cast<T*>(object); 29 delete reinterpret_cast<T*>(object);
30 } 30 }
31 } 31 }
32 32
33 protected:
34 bool DecrementRefWithoutDelete() {
35 ASSERT(ref_count_ > 0);
36 return --ref_count_ == 0;
37 }
38
39 private: 33 private:
40 Atomic<int> ref_count_; 34 Atomic<int> ref_count_;
41 }; 35 };
42 36
43 } // namespace fletch 37 } // namespace fletch
44 38
45 #endif // SRC_VM_REFCOUNTED_H_ 39 #endif // SRC_VM_REFCOUNTED_H_
OLDNEW
« src/vm/process_handle.h ('K') | « src/vm/process_handle.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698