FrameLayers.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * Copyright (C) 2010, 2011, 2012 Research In Motion Limited. All rights reserved.
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2 of the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with this library; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #ifndef FrameLayers_h
  19. #define FrameLayers_h
  20. #if USE(ACCELERATED_COMPOSITING)
  21. #include "GraphicsLayer.h"
  22. #include <wtf/HashMap.h>
  23. #include <wtf/OwnPtr.h>
  24. namespace WebCore {
  25. class Frame;
  26. class LayerWebKitThread;
  27. }
  28. namespace BlackBerry {
  29. namespace WebKit {
  30. class WebPagePrivate;
  31. // This class may only be used on the WebKit thread.
  32. class FrameLayers {
  33. public:
  34. FrameLayers(WebPagePrivate*);
  35. ~FrameLayers();
  36. bool containsLayerForFrame(WebCore::Frame*);
  37. void addLayer(WebCore::Frame*, WebCore::LayerWebKitThread*);
  38. void removeLayerByFrame(WebCore::Frame*);
  39. bool hasLayer() const { return m_frameLayers.size(); }
  40. void commitOnWebKitThread(double scale);
  41. void notifyAnimationsStarted(double animationStartTime);
  42. void calculateRootLayer();
  43. bool isRootLayerMainFrameLayer() const { return m_rootLayer && !m_rootGraphicsLayer; }
  44. // FIXME: This function should only be called on the WebKit thread.
  45. // But it's now also being called on the Compositing thread.
  46. WebCore::LayerWebKitThread* rootLayer() const { return m_rootLayer; }
  47. void releaseLayerResources();
  48. private:
  49. WebPagePrivate* m_pagePrivate;
  50. OwnPtr<WebCore::GraphicsLayer> m_rootGraphicsLayer;
  51. WebCore::LayerWebKitThread* m_rootLayer;
  52. typedef HashMap<WebCore::Frame*, WebCore::LayerWebKitThread*> FrameLayerMap;
  53. FrameLayerMap m_frameLayers;
  54. };
  55. } // namespace BlackBerry
  56. } // namespace WebKit
  57. #endif // USE(ACCELERATED_COMPOSITING)
  58. #endif // FrameLayers_h