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

Side by Side Diff: Source/web/PageOverlayTest.cpp

Issue 1220583004: Refactor DrawingRecorders to check for cached drawings earlier (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix some !'s and &&'s. De Morgan would be proud. Created 5 years, 5 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "config.h" 5 #include "config.h"
6 #include "web/PageOverlay.h" 6 #include "web/PageOverlay.h"
7 7
8 #include "core/frame/FrameView.h" 8 #include "core/frame/FrameView.h"
9 #include "core/layout/LayoutView.h" 9 #include "core/layout/LayoutView.h"
10 #include "platform/graphics/Color.h" 10 #include "platform/graphics/Color.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 98
99 // WebPageOverlay that uses the underlying blink::GraphicsContext to paint a 99 // WebPageOverlay that uses the underlying blink::GraphicsContext to paint a
100 // solid color. 100 // solid color.
101 class PrivateGraphicsContextOverlay : public WebPageOverlay { 101 class PrivateGraphicsContextOverlay : public WebPageOverlay {
102 public: 102 public:
103 PrivateGraphicsContextOverlay(Color color) : m_color(color) { } 103 PrivateGraphicsContextOverlay(Color color) : m_color(color) { }
104 104
105 void paintPageOverlay(WebGraphicsContext* context, const WebSize& size) over ride 105 void paintPageOverlay(WebGraphicsContext* context, const WebSize& size) over ride
106 { 106 {
107 GraphicsContext& graphicsContext = toWebGraphicsContextImpl(context)->gr aphicsContext(); 107 GraphicsContext& graphicsContext = toWebGraphicsContextImpl(context)->gr aphicsContext();
108 FloatRect rect(0, 0, size.width, size.height); 108 if (!DrawingRecorder::useCachedDrawingIfPossible(graphicsContext, *this, DisplayItem::PageOverlay)) {
Xianzhu 2015/07/03 01:24:42 Nit: 'if (DrawingRecorder::...) return;' seems
pdr. 2015/07/03 02:38:04 I agree. Done.
109 DrawingRecorder drawingRecorder(graphicsContext, *this, DisplayItem::Pag eOverlay, rect); 109 FloatRect rect(0, 0, size.width, size.height);
110 if (!drawingRecorder.canUseCachedDrawing()) 110 DrawingRecorder drawingRecorder(graphicsContext, *this, DisplayItem: :PageOverlay, rect);
111 graphicsContext.fillRect(rect, m_color); 111 graphicsContext.fillRect(rect, m_color);
112 }
112 } 113 }
113 114
114 DisplayItemClient displayItemClient() const { return toDisplayItemClient(thi s); } 115 DisplayItemClient displayItemClient() const { return toDisplayItemClient(thi s); }
115 String debugName() const { return "PrivateGraphicsContextOverlay"; } 116 String debugName() const { return "PrivateGraphicsContextOverlay"; }
116 117
117 private: 118 private:
118 Color m_color; 119 Color m_color;
119 }; 120 };
120 121
121 template <bool(*getter)(), void(*setter)(bool)> 122 template <bool(*getter)(), void(*setter)(bool)>
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 } 232 }
232 233
233 TEST_F(PageOverlayTest, PrivateGraphicsContextOverlay_AcceleratedCompositing_Sli mmingPaint) 234 TEST_F(PageOverlayTest, PrivateGraphicsContextOverlay_AcceleratedCompositing_Sli mmingPaint)
234 { 235 {
235 SlimmingPaintScope slimmingPaintEnabled(true); 236 SlimmingPaintScope slimmingPaintEnabled(true);
236 runPageOverlayTestWithAcceleratedCompositing<PrivateGraphicsContextOverlay>( ); 237 runPageOverlayTestWithAcceleratedCompositing<PrivateGraphicsContextOverlay>( );
237 } 238 }
238 239
239 } // namespace 240 } // namespace
240 } // namespace blink 241 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698