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

Side by Side Diff: third_party/WebKit/Source/wtf/LeakAnnotations.h

Issue 2386843002: reflow comments in wtf (Closed)
Patch Set: comments (heh!) Created 4 years, 2 months 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * Copyright (C) 2013 Samsung Electronics. All rights reserved. 3 * Copyright (C) 2013 Samsung Electronics. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // "Ignorance" means that LSan's reachability traversal is stopped short 70 // "Ignorance" means that LSan's reachability traversal is stopped short
71 // upon encountering an ignored memory chunk. Consequently, LSan will not 71 // upon encountering an ignored memory chunk. Consequently, LSan will not
72 // scan an ignored memory chunk for live, reachable pointers. However, should 72 // scan an ignored memory chunk for live, reachable pointers. However, should
73 // those embedded pointers be reachable by some other path, they will be 73 // those embedded pointers be reachable by some other path, they will be
74 // reported as leaking. 74 // reported as leaking.
75 #define LEAK_SANITIZER_IGNORE_OBJECT(X) __lsan_ignore_object(X) 75 #define LEAK_SANITIZER_IGNORE_OBJECT(X) __lsan_ignore_object(X)
76 76
77 // If the object pointed to by the static local is on the Oilpan heap, a strong 77 // If the object pointed to by the static local is on the Oilpan heap, a strong
78 // Persistent<> is created to keep the pointed-to heap object alive. This makes 78 // Persistent<> is created to keep the pointed-to heap object alive. This makes
79 // both the Persistent<> and the heap object _reachable_ by LeakSanitizer's leak 79 // both the Persistent<> and the heap object _reachable_ by LeakSanitizer's leak
80 // detection pass. We do not want these intentional leaks to be reported by LSan , 80 // detection pass. We do not want these intentional leaks to be reported by
81 // hence the static local is registered with Oilpan 81 // LSan, hence the static local is registered with Oilpan
82 // (see RegisterStaticLocalReference<> below.) 82 // (see RegisterStaticLocalReference<> below.)
83 // 83 //
84 // Upon Blink shutdown, all the registered statics are released and a final roun d 84 // Upon Blink shutdown, all the registered statics are released and a final
85 // of GCs are performed to sweep out their now-unreachable object graphs. The en d 85 // round of GCs are performed to sweep out their now-unreachable object graphs.
86 // result being a tidied heap that the LeakSanitizer can then scan to report rea l leaks. 86 // The end result being a tidied heap that the LeakSanitizer can then scan to
87 // report real leaks.
87 // 88 //
88 // The CanRegisterStaticLocalReference<> and RegisterStaticLocalReference<> temp lates 89 // The CanRegisterStaticLocalReference<> and RegisterStaticLocalReference<>
89 // arrange for this -- for a class type T, a registerStatic() implementation is 90 // templates arrange for this -- for a class type T, a registerStatic()
90 // provided if "T* T::registerAsStaticReference(T*)" is a method on T 91 // implementation is provided if "T* T::registerAsStaticReference(T*)" is a
91 // (inherited or otherwise.) 92 // method on T (inherited or otherwise.)
92 // 93 //
93 // An empty, trivial registerStatic() method is provided for all other class typ es T. 94 // An empty, trivial registerStatic() method is provided for all other class
95 // types T.
94 template <typename T> 96 template <typename T>
95 class CanRegisterStaticLocalReference { 97 class CanRegisterStaticLocalReference {
96 typedef char YesType; 98 typedef char YesType;
97 typedef struct NoType { char padding[8]; } NoType; 99 typedef struct NoType { char padding[8]; } NoType;
98 100
99 // Check if class T has public method "T* registerAsStaticReference()". 101 // Check if class T has public method "T* registerAsStaticReference()".
100 template <typename V> 102 template <typename V>
101 static YesType checkHasRegisterAsStaticReferenceMethod( 103 static YesType checkHasRegisterAsStaticReferenceMethod(
102 V* p, 104 V* p,
103 typename std::enable_if<IsSubclass< 105 typename std::enable_if<IsSubclass<
(...skipping 27 matching lines...) Expand all
131 WTF::RegisterStaticLocalReference<Type>::registerStatic(Object) 133 WTF::RegisterStaticLocalReference<Type>::registerStatic(Object)
132 #else 134 #else
133 #define WTF_INTERNAL_LEAK_SANITIZER_DISABLED_SCOPE 135 #define WTF_INTERNAL_LEAK_SANITIZER_DISABLED_SCOPE
134 #define LEAK_SANITIZER_IGNORE_OBJECT(X) ((void)0) 136 #define LEAK_SANITIZER_IGNORE_OBJECT(X) ((void)0)
135 #define LEAK_SANITIZER_REGISTER_STATIC_LOCAL(Type, Object) Object 137 #define LEAK_SANITIZER_REGISTER_STATIC_LOCAL(Type, Object) Object
136 #endif // USE(LEAK_SANITIZER) 138 #endif // USE(LEAK_SANITIZER)
137 139
138 } // namespace WTF 140 } // namespace WTF
139 141
140 #endif // WTF_LeakAnnotations_h 142 #endif // WTF_LeakAnnotations_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/InstanceCounter.cpp ('k') | third_party/WebKit/Source/wtf/LinkedHashSet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698