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

Side by Side Diff: third_party/WebKit/Source/platform/image-encoders/skia/JPEGImageEncoder.h

Issue 1807553002: Fix JPEGImageEncoder memory leak (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 years, 9 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010, Google Inc. All rights reserved. 2 * Copyright (c) 2010, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 class PLATFORM_EXPORT JPEGImageEncoder { 52 class PLATFORM_EXPORT JPEGImageEncoder {
53 STATIC_ONLY(JPEGImageEncoder); 53 STATIC_ONLY(JPEGImageEncoder);
54 public: 54 public:
55 // Encode the image data with a compression quality in [0-100]. 55 // Encode the image data with a compression quality in [0-100].
56 // Warning: Calling this method off the main thread may result in data race 56 // Warning: Calling this method off the main thread may result in data race
57 // problems; instead, call JPEGImageEncoderState::create on main thread 57 // problems; instead, call JPEGImageEncoderState::create on main thread
58 // first followed by encodeWithPreInitializedState off the main thread will 58 // first followed by encodeWithPreInitializedState off the main thread will
59 // be safer. 59 // be safer.
60 static bool encode(const ImageDataBuffer&, const double& quality, Vector<uns igned char>*); 60 static bool encode(const ImageDataBuffer&, const double& quality, Vector<uns igned char>*);
61 61
62 static void encodeWithPreInitializedState(JPEGImageEncoderState*, const unsi gned char*); 62 static bool encodeWithPreInitializedState(PassOwnPtr<JPEGImageEncoderState>, const unsigned char*);
63 static int computeCompressionQuality(const double& quality); 63 static int computeCompressionQuality(const double& quality);
64 64
65 private: 65 private:
66 // For callers: provide a reasonable compression quality default. 66 // For callers: provide a reasonable compression quality default.
67 enum Quality { DefaultCompressionQuality = 92 }; 67 enum Quality { DefaultCompressionQuality = 92 };
68 }; 68 };
69 69
70 } // namespace blink 70 } // namespace blink
71 71
72 #endif 72 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698