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

Side by Side Diff: src/pipe/SkGPipeWrite.cpp

Issue 138803005: Set write buffer flags only in SkWriteBuffer and SkFlatController constructors. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: INHERITED Created 6 years, 10 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/SkWriteBuffer.cpp ('k') | tests/SerializationTest.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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkAnnotation.h" 9 #include "SkAnnotation.h"
10 #include "SkBitmapDevice.h" 10 #include "SkBitmapDevice.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 writer->writePad(data->data(), size); 64 writer->writePad(data->data(), size);
65 } 65 }
66 return 4 + SkAlign4(size); 66 return 4 + SkAlign4(size);
67 } 67 }
68 68
69 /////////////////////////////////////////////////////////////////////////////// 69 ///////////////////////////////////////////////////////////////////////////////
70 70
71 class FlattenableHeap : public SkFlatController { 71 class FlattenableHeap : public SkFlatController {
72 public: 72 public:
73 FlattenableHeap(int numFlatsToKeep, SkNamedFactorySet* fset, bool isCrossPro cess) 73 FlattenableHeap(int numFlatsToKeep, SkNamedFactorySet* fset, bool isCrossPro cess)
74 : fNumFlatsToKeep(numFlatsToKeep) { 74 : INHERITED(isCrossProcess ? SkWriteBuffer::kCrossProcess_Flag : 0)
75 , fNumFlatsToKeep(numFlatsToKeep) {
75 SkASSERT((isCrossProcess && fset != NULL) || (!isCrossProcess && NULL == fset)); 76 SkASSERT((isCrossProcess && fset != NULL) || (!isCrossProcess && NULL == fset));
76 if (isCrossProcess) { 77 if (isCrossProcess) {
77 this->setNamedFactorySet(fset); 78 this->setNamedFactorySet(fset);
78 this->setWriteBufferFlags(SkWriteBuffer::kCrossProcess_Flag);
79 } 79 }
80 } 80 }
81 81
82 ~FlattenableHeap() { 82 ~FlattenableHeap() {
83 fPointers.freeAll(); 83 fPointers.freeAll();
84 } 84 }
85 85
86 virtual void* allocThrow(size_t bytes) SK_OVERRIDE; 86 virtual void* allocThrow(size_t bytes) SK_OVERRIDE;
87 87
88 virtual void unalloc(void* ptr) SK_OVERRIDE; 88 virtual void unalloc(void* ptr) SK_OVERRIDE;
(...skipping 13 matching lines...) Expand all
102 void markAllFlatsSafeToDelete() { 102 void markAllFlatsSafeToDelete() {
103 fFlatsThatMustBeKept.reset(); 103 fFlatsThatMustBeKept.reset();
104 } 104 }
105 105
106 private: 106 private:
107 // Keep track of the indices (i.e. the result of SkFlatData::index()) of 107 // Keep track of the indices (i.e. the result of SkFlatData::index()) of
108 // flats that must be kept, since they are on the current paint. 108 // flats that must be kept, since they are on the current paint.
109 SkTDArray<int> fFlatsThatMustBeKept; 109 SkTDArray<int> fFlatsThatMustBeKept;
110 SkTDArray<void*> fPointers; 110 SkTDArray<void*> fPointers;
111 const int fNumFlatsToKeep; 111 const int fNumFlatsToKeep;
112
113 typedef SkFlatController INHERITED;
112 }; 114 };
113 115
114 void FlattenableHeap::unalloc(void* ptr) { 116 void FlattenableHeap::unalloc(void* ptr) {
115 int indexToRemove = fPointers.rfind(ptr); 117 int indexToRemove = fPointers.rfind(ptr);
116 if (indexToRemove >= 0) { 118 if (indexToRemove >= 0) {
117 sk_free(ptr); 119 sk_free(ptr);
118 fPointers.remove(indexToRemove); 120 fPointers.remove(indexToRemove);
119 } 121 }
120 } 122 }
121 123
(...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 return fCanvas->shuttleBitmap(bitmap, slot); 1235 return fCanvas->shuttleBitmap(bitmap, slot);
1234 } 1236 }
1235 1237
1236 void BitmapShuttle::removeCanvas() { 1238 void BitmapShuttle::removeCanvas() {
1237 if (NULL == fCanvas) { 1239 if (NULL == fCanvas) {
1238 return; 1240 return;
1239 } 1241 }
1240 fCanvas->unref(); 1242 fCanvas->unref();
1241 fCanvas = NULL; 1243 fCanvas = NULL;
1242 } 1244 }
OLDNEW
« no previous file with comments | « src/core/SkWriteBuffer.cpp ('k') | tests/SerializationTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698