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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.h

Issue 1484853003: Ganesh: images upload to GPU performance fix (skip copying encoded data) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review update, assert for appending data to m_allDataReceived Created 5 years 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * 12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #ifndef ImageFrameGenerator_h 26 #ifndef ImageFrameGenerator_h
27 #define ImageFrameGenerator_h 27 #define ImageFrameGenerator_h
28 28
29 #include "SkBitmap.h" 29 #include "SkBitmap.h"
30 #include "SkData.h"
30 #include "SkSize.h" 31 #include "SkSize.h"
31 #include "SkTypes.h" 32 #include "SkTypes.h"
32 #include "platform/PlatformExport.h" 33 #include "platform/PlatformExport.h"
33 #include "platform/graphics/ThreadSafeDataTransport.h" 34 #include "platform/graphics/ThreadSafeDataTransport.h"
34 #include "wtf/PassOwnPtr.h" 35 #include "wtf/PassOwnPtr.h"
35 #include "wtf/PassRefPtr.h" 36 #include "wtf/PassRefPtr.h"
36 #include "wtf/RefCounted.h" 37 #include "wtf/RefCounted.h"
37 #include "wtf/RefPtr.h" 38 #include "wtf/RefPtr.h"
38 #include "wtf/ThreadingPrimitives.h" 39 #include "wtf/ThreadingPrimitives.h"
39 #include "wtf/ThreadSafeRefCounted.h" 40 #include "wtf/ThreadSafeRefCounted.h"
(...skipping 28 matching lines...) Expand all
68 // into |pixels| with a stride of |rowBytes|. 69 // into |pixels| with a stride of |rowBytes|.
69 // 70 //
70 // Returns true if decoding was successful. 71 // Returns true if decoding was successful.
71 bool decodeAndScale(const SkImageInfo&, size_t index, void* pixels, size_t r owBytes); 72 bool decodeAndScale(const SkImageInfo&, size_t index, void* pixels, size_t r owBytes);
72 73
73 // Decodes YUV components directly into the provided memory planes. 74 // Decodes YUV components directly into the provided memory planes.
74 bool decodeToYUV(SkISize componentSizes[3], void* planes[3], size_t rowBytes [3]); 75 bool decodeToYUV(SkISize componentSizes[3], void* planes[3], size_t rowBytes [3]);
75 76
76 void setData(PassRefPtr<SharedBuffer>, bool allDataReceived); 77 void setData(PassRefPtr<SharedBuffer>, bool allDataReceived);
77 78
78 // Creates a new SharedBuffer containing the data received so far. 79 // Returns pointer to SkData. Caller needs to unref it, according to contrac t in
79 void copyData(RefPtr<SharedBuffer>*, bool* allDataReceived); 80 // SkImageGenerator::refEncodedData.
81 SkData* refSkData();
80 82
81 SkISize getFullSize() const { return m_fullSize; } 83 SkISize getFullSize() const { return m_fullSize; }
82 84
83 bool isMultiFrame() const { return m_isMultiFrame; } 85 bool isMultiFrame() const { return m_isMultiFrame; }
84 86
85 // FIXME: Return alpha state for each frame. 87 // FIXME: Return alpha state for each frame.
86 bool hasAlpha(size_t); 88 bool hasAlpha(size_t);
87 89
88 bool getYUVComponentSizes(SkISize componentSizes[3]); 90 bool getYUVComponentSizes(SkISize componentSizes[3]);
89 91
(...skipping 28 matching lines...) Expand all
118 // Prevents multiple decode operations on the same data. 120 // Prevents multiple decode operations on the same data.
119 Mutex m_decodeMutex; 121 Mutex m_decodeMutex;
120 122
121 // Protect concurrent access to m_hasAlpha. 123 // Protect concurrent access to m_hasAlpha.
122 Mutex m_alphaMutex; 124 Mutex m_alphaMutex;
123 }; 125 };
124 126
125 } // namespace blink 127 } // namespace blink
126 128
127 #endif 129 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698