Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef RecordingImageBufferSurface_h | 5 #ifndef RecordingImageBufferSurface_h |
| 6 #define RecordingImageBufferSurface_h | 6 #define RecordingImageBufferSurface_h |
| 7 | 7 |
| 8 #include "platform/graphics/GraphicsContext.h" | 8 #include "platform/graphics/GraphicsContext.h" |
| 9 #include "platform/graphics/ImageBufferSurface.h" | 9 #include "platform/graphics/ImageBufferSurface.h" |
| 10 #include "public/platform/WebThread.h" | 10 #include "public/platform/WebThread.h" |
| 11 #include "third_party/skia/include/core/SkCanvas.h" | 11 #include "third_party/skia/include/core/SkCanvas.h" |
| 12 #include "wtf/LinkedStack.h" | 12 #include "wtf/LinkedStack.h" |
| 13 #include "wtf/OwnPtr.h" | 13 #include "wtf/OwnPtr.h" |
| 14 #include "wtf/RefPtr.h" | 14 #include "wtf/RefPtr.h" |
| 15 | 15 |
| 16 class SkPicture; | 16 class SkPicture; |
| 17 class SkPictureRecorder; | 17 class SkPictureRecorder; |
| 18 class RecordingImageBufferSurfaceTest; | |
| 19 | 18 |
| 20 namespace blink { | 19 namespace blink { |
| 21 | 20 |
| 22 class ImageBuffer; | 21 class ImageBuffer; |
| 22 class RecordingImageBufferSurfaceTest; | |
| 23 | 23 |
| 24 class RecordingImageBufferFallbackSurfaceFactory { | 24 class RecordingImageBufferFallbackSurfaceFactory { |
| 25 public: | 25 public: |
| 26 virtual PassOwnPtr<ImageBufferSurface> createSurface(const IntSize&, Opacity Mode) = 0; | 26 virtual PassOwnPtr<ImageBufferSurface> createSurface(const IntSize&, Opacity Mode) = 0; |
| 27 virtual ~RecordingImageBufferFallbackSurfaceFactory() { } | 27 virtual ~RecordingImageBufferFallbackSurfaceFactory() { } |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 class PLATFORM_EXPORT RecordingImageBufferSurface : public ImageBufferSurface { | 30 class PLATFORM_EXPORT RecordingImageBufferSurface : public ImageBufferSurface { |
| 31 WTF_MAKE_NONCOPYABLE(RecordingImageBufferSurface); WTF_MAKE_FAST_ALLOCATED(R ecordingImageBufferSurface); | 31 WTF_MAKE_NONCOPYABLE(RecordingImageBufferSurface); WTF_MAKE_FAST_ALLOCATED(R ecordingImageBufferSurface); |
| 32 public: | 32 public: |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 55 WebLayer* layer() const override; | 55 WebLayer* layer() const override; |
| 56 bool isAccelerated() const override; | 56 bool isAccelerated() const override; |
| 57 Platform3DObject getBackingTexture() const override; | 57 Platform3DObject getBackingTexture() const override; |
| 58 bool cachedBitmapEnabled() const override; | 58 bool cachedBitmapEnabled() const override; |
| 59 const SkBitmap& cachedBitmap() const override; | 59 const SkBitmap& cachedBitmap() const override; |
| 60 void invalidateCachedBitmap() override; | 60 void invalidateCachedBitmap() override; |
| 61 void updateCachedBitmapIfNeeded() override; | 61 void updateCachedBitmapIfNeeded() override; |
| 62 void setIsHidden(bool) override; | 62 void setIsHidden(bool) override; |
| 63 | 63 |
| 64 private: | 64 private: |
| 65 friend class ::RecordingImageBufferSurfaceTest; // for unit testing | 65 friend class RecordingImageBufferSurfaceTest; // for unit testing |
|
kochi
2015/06/12 05:35:54
nit: add // TODO(tkent): Use FRIEND_TEST macro pro
tkent
2015/06/12 05:46:49
In this case, gtest_prod.h and base/gtest_prod_uti
kochi
2015/06/12 05:54:27
Acknowledged.
| |
| 66 void fallBackToRasterCanvas(); | 66 void fallBackToRasterCanvas(); |
| 67 bool initializeCurrentFrame(); | 67 bool initializeCurrentFrame(); |
| 68 bool finalizeFrameInternal(); | 68 bool finalizeFrameInternal(); |
| 69 int approximateOpCount(); | 69 int approximateOpCount(); |
| 70 | 70 |
| 71 OwnPtr<SkPictureRecorder> m_currentFrame; | 71 OwnPtr<SkPictureRecorder> m_currentFrame; |
| 72 RefPtr<SkPicture> m_previousFrame; | 72 RefPtr<SkPicture> m_previousFrame; |
| 73 OwnPtr<ImageBufferSurface> m_fallbackSurface; | 73 OwnPtr<ImageBufferSurface> m_fallbackSurface; |
| 74 ImageBuffer* m_imageBuffer; | 74 ImageBuffer* m_imageBuffer; |
| 75 int m_initialSaveCount; | 75 int m_initialSaveCount; |
| 76 int m_currentFramePixelCount; | 76 int m_currentFramePixelCount; |
| 77 int m_previousFramePixelCount; | 77 int m_previousFramePixelCount; |
| 78 bool m_frameWasCleared; | 78 bool m_frameWasCleared; |
| 79 bool m_didRecordDrawCommandsInCurrentFrame; | 79 bool m_didRecordDrawCommandsInCurrentFrame; |
| 80 bool m_currentFrameHasExpensiveOp; | 80 bool m_currentFrameHasExpensiveOp; |
| 81 bool m_previousFrameHasExpensiveOp; | 81 bool m_previousFrameHasExpensiveOp; |
| 82 OwnPtr<RecordingImageBufferFallbackSurfaceFactory> m_fallbackFactory; | 82 OwnPtr<RecordingImageBufferFallbackSurfaceFactory> m_fallbackFactory; |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 } // namespace blink | 85 } // namespace blink |
| 86 | 86 |
| 87 #endif | 87 #endif |
| OLD | NEW |