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

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

Issue 395543002: Fix memory leak introduced in http://crrev.com/387863005 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 5 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 | 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
1 1
2 /* 2 /*
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 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 9
10 #include "SkData.h" 10 #include "SkData.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 107
108 bool SkPDFStream::populate(SkPDFCatalog* catalog) { 108 bool SkPDFStream::populate(SkPDFCatalog* catalog) {
109 if (fState == kUnused_State) { 109 if (fState == kUnused_State) {
110 if (!skip_compression(catalog) && SkFlate::HaveFlate()) { 110 if (!skip_compression(catalog) && SkFlate::HaveFlate()) {
111 SkDynamicMemoryWStream compressedData; 111 SkDynamicMemoryWStream compressedData;
112 112
113 SkAssertResult( 113 SkAssertResult(
114 SkFlate::Deflate(fDataStream.get(), &compressedData)); 114 SkFlate::Deflate(fDataStream.get(), &compressedData));
115 SkAssertResult(fDataStream->rewind()); 115 SkAssertResult(fDataStream->rewind());
116 if (compressedData.getOffset() < this->dataSize()) { 116 if (compressedData.getOffset() < this->dataSize()) {
117 this->setData(compressedData.detachAsStream()); 117 SkAutoTUnref<SkStream> compressed(
118 compressedData.detachAsStream());
119 this->setData(compressed.get());
118 insertName("Filter", "FlateDecode"); 120 insertName("Filter", "FlateDecode");
119 } 121 }
120 fState = kCompressed_State; 122 fState = kCompressed_State;
121 } else { 123 } else {
122 fState = kNoCompression_State; 124 fState = kNoCompression_State;
123 } 125 }
124 insertInt("Length", this->dataSize()); 126 insertInt("Length", this->dataSize());
125 } else if (fState == kNoCompression_State && !skip_compression(catalog) && 127 } else if (fState == kNoCompression_State && !skip_compression(catalog) &&
126 SkFlate::HaveFlate()) { 128 SkFlate::HaveFlate()) {
127 if (!fSubstitute.get()) { 129 if (!fSubstitute.get()) {
128 fSubstitute.reset(new SkPDFStream(*this)); 130 fSubstitute.reset(new SkPDFStream(*this));
129 catalog->setSubstitute(this, fSubstitute.get()); 131 catalog->setSubstitute(this, fSubstitute.get());
130 } 132 }
131 return false; 133 return false;
132 } 134 }
133 return true; 135 return true;
134 } 136 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698