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

Side by Side Diff: src/pdf/SkPDFCanon.cpp

Issue 872643005: minor changes left out of http://crrev.com/873543002 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 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 | « no previous file | src/pdf/SkPDFShader.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 2015 Google Inc. 2 * Copyright 2015 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 "SkLazyPtr.h" 8 #include "SkLazyPtr.h"
9 #include "SkPDFCanon.h" 9 #include "SkPDFCanon.h"
10 #include "SkPDFFont.h" 10 #include "SkPDFFont.h"
(...skipping 21 matching lines...) Expand all
32 //////////////////////////////////////////////////////////////////////////////// 32 ////////////////////////////////////////////////////////////////////////////////
33 33
34 static void assert_mutex_held(const SkPDFCanon* canon, SkBaseMutex& mutex) { 34 static void assert_mutex_held(const SkPDFCanon* canon, SkBaseMutex& mutex) {
35 if (canon == singleton.get()) { 35 if (canon == singleton.get()) {
36 mutex.assertHeld(); 36 mutex.assertHeld();
37 } 37 }
38 } 38 }
39 39
40 template <class T> T* assert_ptr(T* p) { SkASSERT(p); return p; } 40 template <class T> T* assert_ptr(T* p) { SkASSERT(p); return p; }
41 41
42 // TODO(halcanary): add this method to SkTDArray.
43 template <typename T> 42 template <typename T>
44 bool remove_item(SkTDArray<T>* array, const T& elem) { 43 bool remove_item(SkTDArray<T>* array, const T& elem) {
45 int i = array->find(elem); 44 int i = array->find(elem);
46 if (i >= 0) { 45 if (i >= 0) {
47 array->removeShuffle(i); 46 array->removeShuffle(i);
48 return true; 47 return true;
49 } 48 }
50 return false; 49 return false;
51 } 50 }
52 51
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 161
163 void SkPDFCanon::addGraphicState(SkPDFGraphicState* state) { 162 void SkPDFCanon::addGraphicState(SkPDFGraphicState* state) {
164 assert_mutex_held(this, gSkPDFCanonPaintMutex); 163 assert_mutex_held(this, gSkPDFCanonPaintMutex);
165 fGraphicStateRecords.push(assert_ptr(state)); 164 fGraphicStateRecords.push(assert_ptr(state));
166 } 165 }
167 166
168 void SkPDFCanon::removeGraphicState(SkPDFGraphicState* pdfGraphicState) { 167 void SkPDFCanon::removeGraphicState(SkPDFGraphicState* pdfGraphicState) {
169 assert_mutex_held(this, gSkPDFCanonPaintMutex); 168 assert_mutex_held(this, gSkPDFCanonPaintMutex);
170 SkAssertResult(remove_item(&fGraphicStateRecords, pdfGraphicState)); 169 SkAssertResult(remove_item(&fGraphicStateRecords, pdfGraphicState));
171 } 170 }
OLDNEW
« no previous file with comments | « no previous file | src/pdf/SkPDFShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698