OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkOncePtr.h" | |
9 #include "SkRemotableFontMgr.h" | 8 #include "SkRemotableFontMgr.h" |
10 | 9 |
| 10 #include "SkLazyPtr.h" |
| 11 |
11 SkRemotableFontIdentitySet::SkRemotableFontIdentitySet(int count, SkFontIdentity
** data) | 12 SkRemotableFontIdentitySet::SkRemotableFontIdentitySet(int count, SkFontIdentity
** data) |
12 : fCount(count), fData(count) | 13 : fCount(count), fData(count) |
13 { | 14 { |
14 SkASSERT(data); | 15 SkASSERT(data); |
15 *data = fData; | 16 *data = fData; |
16 } | 17 } |
17 | 18 |
18 SK_DECLARE_STATIC_ONCE_PTR(SkRemotableFontIdentitySet, empty); | 19 // As a template argument, this must have external linkage. |
| 20 SkRemotableFontIdentitySet* sk_remotable_font_identity_set_new() { |
| 21 return new SkRemotableFontIdentitySet; |
| 22 } |
| 23 |
| 24 SK_DECLARE_STATIC_LAZY_PTR(SkRemotableFontIdentitySet, empty, sk_remotable_font_
identity_set_new); |
19 SkRemotableFontIdentitySet* SkRemotableFontIdentitySet::NewEmpty() { | 25 SkRemotableFontIdentitySet* SkRemotableFontIdentitySet::NewEmpty() { |
20 return SkRef(empty.get([]{ return new SkRemotableFontIdentitySet; })); | 26 return SkRef(empty.get()); |
21 } | 27 } |
OLD | NEW |