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

Side by Side Diff: src/codec/SkJpegAutoClean.h

Issue 1076923002: SkJpegCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@gif-real
Patch Set: SkJpegCodec Created 5 years, 8 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
(Empty)
1 /*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #ifndef SkJpegAutoClean_DEFINED
9 #define SkJpegAutoClean_DEFINED
10
11 #include "SkTemplates.h"
12 #include <stdio.h>
scroggo 2015/04/10 17:19:05 We should not be using stdio.
msarett 2015/04/13 20:54:04 jpeglib has some sort of odd dependence on stdio.
13 extern "C" {
scroggo 2015/04/10 17:19:05 For our other codec headers, we've discovered that
msarett 2015/04/13 20:54:04 Looks like that is the case here.
14 #include "jpeglib.h"
15 }
16
17 /*
18 * This object automatically cleans up memory after a jpeg decode
19 */
20 class JpegAutoClean {
scroggo 2015/04/10 17:19:05 This should inherit from SkNoncopyable.
msarett 2015/04/13 20:54:04 Done.
21 public:
22
23 /*
24 * Takes ownership of jpegInfo pointer.
25 */
26 JpegAutoClean(jpeg_decompress_struct* jpegInfo, bool init);
scroggo 2015/04/10 17:19:05 nit: Traditionally, jpeg_decompress_struct is name
msarett 2015/04/13 20:54:04 Maybe for "compress info" and "decompress info"?
27
28 /*
29 * Frees the owned jpeg_decompress_struct pointer as well as any allocated m emory
30 * that is referenced in the jpeg_decompress_struct.
31 */
32 ~JpegAutoClean();
33
34 /*
35 * Indicates if the jpeg info struct has been initialized with data.
36 */
37 void setInit(bool init);
38
39 /*
40 * Get the jpeg info pointer.
41 * Retains ownership of the jpeg_decompress_struct pointer.
42 */
43 jpeg_decompress_struct* get();
44
45 /*
46 * Detach the jpeg_decompress_struct pointer.
47 * It is now owned by the caller.
48 */
49 jpeg_decompress_struct* detach();
50
51 /*
52 * Reset the pointer that is owned by this object.
53 * This will free the original pointer and takes ownership of the pointer pa ssed
54 * as an argument.
55 */
56 void reset(jpeg_decompress_struct* jpegInfo);
57
58 private:
59
60 /*
61 * Frees the owned jpeg_decompress_struct pointer as well as any allocated m emory
62 * that is referenced in the jpeg_decompress_struct.
63 */
64 void free();
65
66 SkAutoTDelete<jpeg_decompress_struct> fJpegInfo;
67 bool fInit;
68 };
69
70 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698