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

Side by Side Diff: skia/config/sk_ref_cnt_base_debug.h

Issue 29763002: Enable reference adoption run time checks for Blink+skia in Debug builds (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added missing SK_API Created 7 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 | Annotate | Revision Log
« skia/config/SkUserConfig.h ('K') | « skia/config/SkUserConfig.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
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef SK_REF_CNT_BASE_DEBUG_H_
6 #define SK_REF_CNT_BASE_DEBUG_H_
7
8 // Alternate implementation of SkRefCntBase for Chromium debug builds
9 class SK_API SkRefCntBase {
10 public:
11 SkRefCntBase() : flags_(0) {}
12 void aboutToRef() const { SkASSERT(flags_ != AdoptionRequired_Flag); }
13 void adopted() const { flags_ |= Adopted_Flag; }
14 void requireAdoption() const { flags_ |= AdoptionRequired_Flag; }
15 private:
16 enum {
17 Adopted_Flag = 0x1,
Stephen White 2013/10/21 22:11:28 Is the spacing on these enums really Chrome-correc
18 AdoptionRequired_Flag = 0x2,
19 };
20
21 mutable int flags_;
22 };
23
24 // Bootstrap for Blink's WTF::RefPtr
25
26 namespace WTF {
27 inline void adopted(const SkRefCntBase* object) {
28 if (!object)
29 return;
30 object->adopted();
31 }
32 inline void requireAdoption(const SkRefCntBase* object) {
33 if (!object)
34 return;
35 object->requireAdoption();
36 }
37 };
38
39 using WTF::adopted;
40 using WTF::requireAdoption;
41
42 #endif
43
OLDNEW
« skia/config/SkUserConfig.h ('K') | « skia/config/SkUserConfig.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698