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

Side by Side Diff: src/fonts/SkRemotableFontMgr.cpp

Issue 1949313003: Reland of SkOncePtr -> SkOnce (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « src/core/SkXfermode.cpp ('k') | src/lazy/SkDiscardableMemoryPool.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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" 8 #include "SkOnce.h"
9 #include "SkRemotableFontMgr.h" 9 #include "SkRemotableFontMgr.h"
10 10
11 SkRemotableFontIdentitySet::SkRemotableFontIdentitySet(int count, SkFontIdentity ** data) 11 SkRemotableFontIdentitySet::SkRemotableFontIdentitySet(int count, SkFontIdentity ** data)
12 : fCount(count), fData(count) 12 : fCount(count), fData(count)
13 { 13 {
14 SkASSERT(data); 14 SkASSERT(data);
15 *data = fData; 15 *data = fData;
16 } 16 }
17 17
18 SK_DECLARE_STATIC_ONCE_PTR(SkRemotableFontIdentitySet, empty);
19 SkRemotableFontIdentitySet* SkRemotableFontIdentitySet::NewEmpty() { 18 SkRemotableFontIdentitySet* SkRemotableFontIdentitySet::NewEmpty() {
20 return SkRef(empty.get([]{ return new SkRemotableFontIdentitySet; })); 19 static SkOnce once;
20 static SkRemotableFontIdentitySet* empty;
21 once([]{ empty = new SkRemotableFontIdentitySet; });
22 return SkRef(empty);
21 } 23 }
OLDNEW
« no previous file with comments | « src/core/SkXfermode.cpp ('k') | src/lazy/SkDiscardableMemoryPool.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698