1 /* 2 * Copyright 2011, The Android Open Source Project 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * * Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * * Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * 13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 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. 24 */ 25 26 #ifndef TilesTracker_h 27 #define TilesTracker_h 28 29 #if USE(ACCELERATED_COMPOSITING) 30 31 #include <cutils/log.h> 32 #include <wtf/CurrentTime.h> 33 #include <wtf/text/CString.h> 34 35 #undef XLOG 36 #define XLOG(...) android_printLog(ANDROID_LOG_DEBUG, "TilesTracker", __VA_ARGS__) 37 38 namespace WebCore { 39 40 class TilesTracker { 41 public: 42 TilesTracker() { 43 clear(); 44 } 45 46 void track(bool ready, bool haveTexture) { 47 m_nbTextures++; 48 if (ready) 49 m_nbTexturesReady++; 50 else 51 m_nbTexturesNotReady++; 52 if (haveTexture) 53 m_nbTexturesUsed++; 54 } 55 56 void clear() { 57 m_nbLayers = 0; 58 m_nbVisibleLayers = 0; 59 m_nbTextures = 0; 60 m_nbTexturesReady = 0; 61 m_nbTexturesNotReady = 0; 62 m_nbTexturesUsed = 0; 63 } 64 65 void trackLayer() { m_nbLayers++; } 66 void trackVisibleLayer() { m_nbVisibleLayers++; } 67 68 void showTrackTextures() { 69 XLOG("We had %d/%d layers needing %d textures, we had %d, %d were ready, %d were not", 70 m_nbLayers, m_nbVisibleLayers, m_nbTextures, m_nbTexturesUsed, m_nbTexturesReady, m_nbTexturesNotReady); 71 } 72 73 private: 74 int m_nbLayers; 75 int m_nbVisibleLayers; 76 int m_nbTextures; 77 int m_nbTexturesReady; 78 int m_nbTexturesNotReady; 79 int m_nbTexturesUsed; 80 }; 81 82 } // namespace WebCore 83 84 #endif // USE(ACCELERATED_COMPOSITING) 85 #endif // TilesTracker_h 86